Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Do you or are you going to support keys Enumerator or indexer #93

Closed
PrimeObjects opened this issue Aug 12, 2015 · 4 comments
Closed

Do you or are you going to support keys Enumerator or indexer #93

PrimeObjects opened this issue Aug 12, 2015 · 4 comments

Comments

@PrimeObjects
Copy link

some think like this

foreach(string key in  distributeCache.keys)
{
}
@PrimeObjects PrimeObjects changed the title Do you or are you going to support keys Enumerator Do you or are you going to support keys Enumerator or indexer Aug 12, 2015
@Eilon
Copy link
Member

Eilon commented Aug 13, 2015

@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?

@PrimeObjects
Copy link
Author

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

@Eilon
Copy link
Member

Eilon commented Aug 13, 2015

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.

@PrimeObjects
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants