public IDictionary <TId, TEntity> GetCacheFor <TEntity, TId>() where TEntity : IEntity <TId>
        {
            string key = GetEntityCacheKey <TEntity, TId>();

            if (!_rawCache.Contains(key))
            {
                var newCache = ConcurrentDictionaryProvider.Create <TEntity, TId>();
                _rawCache.Put(key, newCache, new SlidingExpirationPolicy(key, newCache, EntityAccessTimeout));
            }
            return(_rawCache.Get <IDictionary <TId, TEntity> >(key));
        }
Exemple #2
0
 public CacheProvider()
 {
     _defaultPolicy = new NullExpirationPolicy();
     Cache          = ConcurrentDictionaryProvider.Create <object, ItemPolicyPair>();
 }