示例#1
0
        public void Set(string key, T value, TimeSpan timeOut)
        {
            var mc = new MemoryCacheItem <T>()
            {
                Key = key, Value = value, Expired = DateTimeHelper.Now.AddSeconds(timeOut.TotalSeconds)
            };

            _dic.AddOrUpdate(key, mc, (k, v) => { return(mc); });
        }
 public bool Del(string key, out MemoryCacheItem <T> mc)
 {
     return(_dic.TryRemove(key, out mc));
 }