Sam
Sam

Reputation: 5721

Selective clearing of ehcache entries

I'm using Ehcache 3.4 and I have a situation where I need to clear entries from a cache based on their keys. I do not know the keys in advance and I haven't found a clean way to list them from the cache. I read somewhere that listing the keys of a cache is an antipattern and I agree on that, but now I can't see a good way out of this.
Things I've tried or considered:

I can clear the whole cache, but that results in a performance hit I'd like to avoid. What are my options?

Upvotes: 1

Views: 209

Answers (1)

Henri
Henri

Reputation: 5721

I don't see what you could do apart from iterating on the entries.

If it wasn't a cache, but let's say a Map, what would you do?

Upvotes: 1

Related Questions