Пример #1
0
        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));
        }
Пример #2
0
 public CacheProvider()
 {
     _defaultPolicy = new NullExpirationPolicy();
     Cache          = ConcurrentDictionaryProvider.Create <object, ItemPolicyPair>();
 }