Пример #1
0
 private void ProcessStorage()
 {
     try
     {
         obj_rwl.AcquireWriterLock(System.Threading.Timeout.Infinite);
         //在对象集合中寻找
         List <CCacheItem_WuQi <K, T> > result = new List <CCacheItem_WuQi <K, T> >();
         foreach (KeyValuePair <K, CCacheItem_WuQi <K, T> > defront in obj_containers)
         {
             CCacheItem_WuQi <K, T> item = (CCacheItem_WuQi <K, T>)defront.Value;
             if (false != item.IsExpire(intervalMinuteTime))
             {
                 result.Add(item);
             }
         }
         foreach (CCacheItem_WuQi <K, T> item in result)
         {
             obj_containers.Remove(item.key);
         }
     }
     catch (System.Exception e)
     {
         CExceptionContainer_WuQi.ProcessException(e);
         throw e;
     }
     finally
     {
         obj_rwl.ReleaseWriterLock();
     }
 }
Пример #2
0
 public bool Delete(K k, ref ICacheStorage_WuQi <K, T> container)
 {
     if (container.Contains(k))
     {
         container.Remove(k);
     }
     return(true);
 }
Пример #3
0
 public int Delete(List <CCacheItem_WuQi <K, T> > listitem, ref ICacheStorage_WuQi <K, T> container)
 {
     foreach (CCacheItem_WuQi <K, T> item in listitem)
     {
         if (container.Contains(item.key))
         {
             container.Remove(item.key);
         }
     }
     return(listitem.Count);
 }