示例#1
0
 /// <summary>
 /// 获取本地缓存
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public override object Get(string key)
 {
     if (DoNet.Common.IO.PathMg.IsWeb)
     {
         return(HttpContext.Current.Cache[key]);
     }
     else
     {
         return(PoolCach.GetObject(key));
     }
 }
示例#2
0
 /// <summary>
 /// 移除缓存
 /// </summary>
 /// <param name="key"></param>
 public override void Remove(string key)
 {
     if (DoNet.Common.IO.PathMg.IsWeb)
     {
         HttpContext.Current.Cache.Remove(key);
     }
     else
     {
         PoolCach.ClearObject(key);
     }
 }
示例#3
0
 /// <summary>
 /// 插入本地缓存
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="tspan"></param>
 public override void Insert(string key, object value, TimeSpan tspan)
 {
     if (DoNet.Common.IO.PathMg.IsWeb)
     {
         HttpContext.Current.Cache.Insert(key, value, null, System.Web.Caching.Cache.NoAbsoluteExpiration, tspan);
     }
     else
     {
         PoolCach.UpdateObject(key, value, tspan);
     }
 }
示例#4
0
 /// <summary>
 /// 插入本地缓存
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override void Insert(string key, object value)
 {
     if (DoNet.Common.IO.PathMg.IsWeb)
     {
         HttpContext.Current.Cache.Insert(key, value);
     }
     else
     {
         PoolCach.SetObject(key, value);
     }
 }
示例#5
0
        string _sSessionID  = "";//缓存集合标识
        public CacheMg(string SessionID)
        {
            _sSessionID = SessionID;
            if (!lSessionKeys.Contains(SessionID))
            {
                lSessionKeys.Add(SessionID);
            }
            Dictionary <string, object> dic = PoolCach.GetObject(_sSessionID) as Dictionary <string, object>;

            if (dic == null)
            {
                dic = new Dictionary <string, object>();
                PoolCach.UpdateObject(_sSessionID, dic);
            }
        }
示例#6
0
 /// <summary>
 /// 移除缓存集合
 /// </summary>
 /// <param name="SessionID"></param>
 public static void RemoveSession(string SessionID)
 {
     lSessionKeys.Remove(SessionID);
     PoolCach.ClearObject(SessionID);
 }
示例#7
0
 public void Clear()
 {
     PoolCach.ClearObject(_sSessionID);
 }