none
Return whole cache RRS feed

  • Question

  • Does anyone know of a way to return all items in the cache when using CacheFactory.GetCacheManager?  I am able to return values if I pass in a key, but i really want to pass the whole manager back or loop through it.  Here is our method that works with a key value:

     

    public static T RetrieveFromCache<T>(string key)

    {

    CacheManager manager = CacheFactory.GetCacheManager();

    if (!manager.Contains(key))

    {

    return default(T);

    }

    return (T)manager[key];

    }

     

     

    Thanks

    Friday, August 17, 2007 4:55 PM

All replies

  • Can you please explain a bit more?

    Sunday, August 19, 2007 4:46 PM
  • Off the top of my head without checking the code it does not expose the cache collection directly as you noted, you need to expose the results of the call to Cache.GetCurrentCacheState in a new method in the CacheManager class you could does this by exposing the hashtable directly or using the enumerator implementation pattern.

     

    Questions about ent. li.b are best asked in the following forums:

     

    http://www.codeplex.com/entlib

     

     

    HTH

     

    Ollie Riches

    Monday, August 20, 2007 1:29 PM