Caching Block - Find Predicate

Topics: Caching Application Block
Aug 14, 2008 at 6:44 PM

I am looking for a way to extend the functionality of the Cache Block.  What I would like to do treat the cache store like a List<T> and use Find and FindAll features that take a Predicate<T> similar to List<T>.Find(Predicate<T>).    I could enumerate through the table, but that may introduce thread safety issues or the feared performance/locking hit.  This is what I would like to do:

 

public CachedObject FindByPredicate()

{

    ICacheManager _cacheManager = CacheFactory.GetCacheManager("Cache Manager");

    return _cacheManager.Find<CachedObject>(match => match != null && 
                                            
match.Name.Contains("Test")&&
                                            
match.BirthDate.CompareTo(new DateTime(1972,6,5))>0);

}

 

Any suggestions?