Open codingaddicted opened 2 months ago
Hi @codingaddicted , sorry for the delay.
I'm working on adding tagging support, which would be even more powerful than regions.
Will update as soon as there's something more concrete.
Hi @jodydonetti, thank you for your feedback.
I agree with you that tags would be even a more flexible solution than a single region, as they would allow you to link a single cache item to multiple "groups". Tag support is also an opened issue on the other caching library I'm currently using, but they have no plans to implement the feature.
This would be a turnkey point for your project. Iβll keep a close eye on how this evolves with great interest.
Hi @codingaddicted , sorry for the delay.
I'm working on adding tagging support, which would be even more powerful than regions.
Will update as soon as there's something more concrete.
Oh... that would be uber-super feature. We are developing a new version of our product. For now we use some in-house implementation of our own IHybridCache
but in our implementation is lack of eviction by tags.
Our code with use-cases suffer and we need this badly. :)
We will look forward for your continuation on this. πΈ
Oh... that would be uber-super feature
Eh, I know but it's uber-super complex to do with the limited IDistributedCache
as a supporting interface π
Now I'm on vacation, but when I come back I'll create an issue with the details there.
Eh, I know but it's uber-super complex to do with the limited IDistributedCache as a supporting interface π
@jodydonetti maybe event not possible...
How is going? π
Checkout RedisOutputCacheStore.EvictByTagAsync
implementation ππ»
UPDATE: it is happening π₯³
Any help would be appreciated!
Hi all, v2.0.0-preview-1 is out π₯³ This includes Tagging and Clear() support!
π Please, if you can try it out and let me know what you think, how it feels to use it or anything else really: your contribution is essential, thanks!
Problem
When you have a cache containing items grouped in some way (within the same cache instance), you may have the need to remove/invalidate them as a set and not by every single item key (you also may not have all their keys). For example, if you are using cache for many elements within a container and you want to invalidate all of them in a single operation knowing the container identifier only.
In this cases you probably compose the cache key using a common prefix (the group id or something similar), but the supported invalidation/removal methods only work on specific key and they don't support a "starts with" logic for example.
Solution
Some other cache libraries support the concept of "region". When you set a cache entry, you can do it using the key only or a key/region pair. In this way all invalidation procedures can be easily done using the single key (obviously) and also using the region identifier, to remove all associated items.
Alternatives
An alternative solution (easier to achive, but more flexible for some aspects) solution could be supporting a startsWith/endsWith/contains (or even RegEx) logic on cache key on invalidation operations. In this way you can use prefixes to identify more then one item.
Example
Both solutions stand on an abstraction to handle region items keys, which need to be saved internally on every provider. For example, in
MemoryCacheAccessor
, theSetEntry
method should manage something like this:On the other way, the
RemoveEntry
should be