Skip to content

Enhancement to IDistributedCache - Allow for bulk remove and key enumeration #44512

Closed
2 of 3 issues completed

Description

@maryamariyan

As @eerhardt and I were triaging through caching extensions issues, we noticed a theme of requests being around allowing for key enumeration and bulk removal of items in IDistributedCache.

We closed a number of items as dupes of the above issues as well.

More information on the intricacies of this issue and ways to approach it:

  • When using caching in extensions, we don't want to allow enumerating on keys while elements may get removed within another thread, (keeping as atomic operation). In order to allow for (e.g. bulk remove) we can offer returning a snapshot (say array of elements. For example to allow for bulk remove of items with a certain prefix (e.g. "ZZZ"), given a snapshot, we may use TryGetValue and if already gone it would not throw.

Sub-issues

Sub-issues

2 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    untriaged
    User Story
    on Nov 11, 2020
  2. added this to the 6.0.0 milestone on Nov 11, 2020
  3. removed
    untriaged
    on Nov 11, 2020
  4. added
    Bottom Up Work
    on Dec 1, 2020
  5. udlose commented on Dec 31, 2020

    @udlose
    • ..... For example to allow for bulk remove of items with a certain prefix (e.g. "ZZZ"), given a snapshot, we may use TryGetValue and if already gone it would not throw.

    @maryamariyan, StackExchange.Redis.IDatabase.KeyDeleteAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None) does not throw an exception if a key is not found. See - https://github.com/StackExchange/StackExchange.Redis/blob/6409b9d1f2afd01a7eab9498a525360d1ca2b752/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs#L442

    Is there a concern I'm missing?

  6. kosmakoff commented on Mar 17, 2021

    @kosmakoff

    I wonder if it is being worked on. I recently stumbled upon a case when I very much need to enumerate values (or keys at least) by pattern (prefix), otherwise I will have to use underlying caching solution directly, which breaks my abstractions.

  7. udlose commented on Mar 17, 2021

    @udlose
  8. eerhardt commented on Jul 19, 2021

    @eerhardt
    Member

    We've reached feature complete for .NET 6. Moving to 7.

  9. modified the milestones: 6.0.0, 7.0.0 on Jul 19, 2021
  10. 6 remaining items

  11. added this to the 8.0.0 milestone on Jun 14, 2022
  12. added
    Epic
    on Oct 18, 2022
  13. wilkovanderveen commented on Feb 8, 2023

    @wilkovanderveen

    It seems that this is already possible with libraries such as EasyCaching.

  14. modified the milestones: 8.0.0, 9.0.0 on Jul 28, 2023
  15. modified the milestones: 9.0.0, Future on Jul 18, 2024
  16. modified the milestones: Future, 11.0.0 on Mar 11, 2026
  17. rosebyte commented on Mar 11, 2026

    @rosebyte
    Member

    Triage: we see only one item left so we will track that one and close this epic.

  18. locked and limited conversation to collaborators on Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bottom Up WorkEpicTeam:LibrariesUser Storyarea-Extensions-Caching

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions