Пример #1
0
        public TCacheDataModel GetItem <TCacheDataModel>(CacheKey key) where TCacheDataModel : ICacheDataModel
        {
            return(_memoryCache.GetOrCreate(key.GetEnumMemberAttrValue(), entry =>
            {
                entry.Priority = CacheItemPriority.NeverRemove;

                return Activator.CreateInstance <TCacheDataModel>();
            }));
        }
Пример #2
0
        public void RemoveItem(CacheKey key)
        {
            _memoryCache.Remove(key.GetEnumMemberAttrValue());

            _memoryCacheKeys.Remove(key);
        }