Exemplo n.º 1
0
 public int Add(object argKey, object argValue, DateTime expiration)
 {
     lock (this._object)
     {
         if (!((Dic == null) || Dic.ContainsKey(argKey)))
         {
             CacheBody body = new CacheBody {
                 Body           = argValue,
                 Expiration     = expiration,
                 DependencyFile = string.Empty
             };
             Dic.Add(argKey, body);
             return(1);
         }
         return(0);
     }
 }
Exemplo n.º 2
0
 public int Insert(object argKey, object argValue)
 {
     lock (this._object)
     {
         if (Dic != null)
         {
             if (Dic.ContainsKey(argKey))
             {
                 Dic[argKey].Body = argValue;
             }
             else
             {
                 CacheBody body = new CacheBody {
                     Body           = argValue,
                     Expiration     = DateTime.MaxValue,
                     DependencyFile = string.Empty
                 };
                 Dic.Add(argKey, body);
             }
             return(1);
         }
         return(0);
     }
 }