Reputation: 1603
I would like to clear cache based on prefix of a key. Eg, i am having a composite key of two objects for a cache, like ({#obj1,#obj2})
. While clearing cache, i would like to clear based on just obj1 value. Like clear everything in a cache with key prefix obj1
. Is it possible?
Upvotes: 0
Views: 514
Reputation: 5711
Apart from iterator throughout the cache, not. Another solution could be to create one cache per prefix.
Finally, another solution would be to use a store instead, that allows querying and to have an index on secondary field. Which will allow your to clear items based on the prefix field. You won't get the other benefits of a cache (eviction, expiration) but it will do what you want.
Upvotes: 1