Do you or are you going to support keys Enumerator or indexer
PrimeObjects opened this issue · 4 comments
some think like this
foreach(string key in distributeCache.keys)
{
}
@lodejard for thoughts.
I think it's doubtful this would be available because part of the idea with caching is that mere moments after you ask it a question, the answer could have changed. That is, suppose you have the answer to which keys are there - a moment later the cache is purged and the list of keys you have is invalid.
Do you have a scenario for this?
when you have a group of cache with same prefix in the key, you want to remove them all. Although it is not ideal to scan whole cache collection to find the group of cache by prefix, it is the only solution i know in old .net. any better idea? maybe we can do cache dependency on another cache.
thanks
Gary
Do you know the list of possible keys statically? That is, are they always "foo.bar", "foo.baz", and "foo.qux"? If so, surely you could just delete all those keys regardless of whether they exist.
If the keys are not known at all (aside from a prefix), you could maintain a list of keys locally in the app and delete based off of that.
yes, I thought about what you said when I was answering your question. Although we use cache to maintain some metadata (e.g entityname.attributename) defined by customer (means our program does not know the keys in a hard coded way), we are able to find a list of keys from database. We will have to change our code. I will close this issue.
Thank you for the help!
Gary