Reputation: 14148
This is regarding MS Enterprise Application Block cache.
Is there a way to see what is inside cache in terms of keys? I am trying to find out if there is a way to query into cache object and find out which keys are stored in there. Then, once I have the keys, I could query the keys and see what is stored in them. Please let me know if this is possible.
Upvotes: 0
Views: 91
Reputation: 71
You need to create your own BackingStore, implementing from IBackingStore. You then can do anything you want in there, for example, maintain a List with all the Keys with each Add/Remove issues to your own BackingStore. Example as follows:
public class MyBackingStore : IBackingStore
{
public List<string> keys = new List<string>();
public void Add(CacheItem newCacheItem)
{
keys.Add(newCacheItem.Key);
}
public void Remove(string key)
{
keys.Remove(key);
}
}
Upvotes: 1