Пример #1
0
        public override void Set(string key, byte[] value, int minutes)
        {
#if !(NETCORE || CORE)
            _memoryCache.Set(key, value, _cacheItemPolicy);
#else
            Microsoft.Extensions.Caching.Memory.ICacheEntry cacheEntry = _memoryCache.CreateEntry(key);
            cacheEntry.SlidingExpiration = TimeSpan.FromMinutes(this.minutes);
            cacheEntry.Value             = value;
#endif
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public void Set <T>(string key, T value)
 {
     c.ICacheEntry entry = Cache.CreateEntry(key);
     entry.Value = value;
 }