CacheManager icon indicating copy to clipboard operation
CacheManager copied to clipboard

Support for tagged cache items using multiple tags (multiple "regions")?

Open sfmskywalker opened this issue 8 years ago • 4 comments

The API currently has a notion of a cache "region", which is a convenient way to group related cache entries so I can evict them using that region. But I have a scenario where I would like to be able to assign multiple regions (tags) to a cache item, so that I can evict all associated cache items by either Tag A or Tag B.

Is this something you think may be useful to have?

sfmskywalker avatar Nov 22 '17 17:11 sfmskywalker

Hi @sfmskywalker, sure, that might be useful. But this would be very different than how Regions currently are implemented and I currently have no plans of implementing something like this.

MichaCo avatar Nov 24 '17 10:11 MichaCo

Understood. I've seen such an implementation where a separate dictionary was being maintained, where each tag was a key, with the cache key as its value. This could probably be implemented as a separate class library, but I'll create a PR for your consideration.

sfmskywalker avatar Nov 24 '17 22:11 sfmskywalker

I'd also have a lot of use for multiple tags. Consider a scenario where an aggregated sum of something consists of readings from multiple devices. The aggregated sum is handy to keep cached but when one of the devices in the aggregation sends new data, the aggregated sum should be invalidated from cache and calculated on the next request or by eventing as the invalidation has happened.

@sfmskywalker are you still working on the PR? I'd be happy to help.

mkontula avatar Jan 09 '18 09:01 mkontula

@mkontula I haven't started yet, and it doesn't look like I will be needing this myself anytime soon. Please feel free to take it on.

sfmskywalker avatar Jan 09 '18 12:01 sfmskywalker