Exemplo n.º 1
0
 /// <summary>
 /// 清除缓存数据
 /// </summary>
 private static void clearCache()
 {
     if (errorQueue.Count != 0)
     {
         errorQueue = new FifoPriorityQueue <HashString, string>();
     }
 }
 /// <summary>
 /// 重置更新版本
 /// </summary>
 private void onReset()
 {
     Array.Clear(ArrayCache, 0, ArrayCache.Length);
     if (Queue.Count != 0)
     {
         Queue = new FifoPriorityQueue <RandomKey <int>, PageCacheVersion <valueType> >(fifoPageCount);
     }
 }
 /// <summary>
 /// 二叉树分页缓存
 /// </summary>
 /// <param name="dictionary">二叉树字典</param>
 /// <param name="pageSize">分页大小</param>
 /// <param name="arrayPageCount">数组缓存数量</param>
 /// <param name="fifoPageCount">先进先出缓存数量</param>
 protected DictionaryPageCacheBase(Dictionary <keyType, valueType> dictionary, int pageSize, int arrayPageCount, int fifoPageCount)
 {
     this.dictionary    = dictionary;
     this.pageSize      = pageSize;
     this.fifoPageCount = fifoPageCount;
     ArrayCache         = new PageCacheVersion <valueType> [arrayPageCount];
     Queue = new FifoPriorityQueue <RandomKey <int>, PageCacheVersion <valueType> >(fifoPageCount);
     dictionary.OnResetVersion += onReset;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 日志流客户端
 /// </summary>
 /// <param name="getLog">获取日志数据委托</param>
 /// <param name="getKey">获取关键字委托</param>
 /// <param name="getValue">获取数据委托</param>
 /// <param name="getValueAwaiter">获取数据委托</param>
 /// <param name="maxCount">最大数量</param>
 /// <param name="log">日志处理</param>
 public QueueClient(Func <Action <AutoCSer.Net.TcpServer.ReturnValue <Log <valueType, modelType> .Data> >, AutoCSer.Net.TcpServer.KeepCallback> getLog
                    , Func <modelType, keyType> getKey, Func <keyType, AutoCSer.Net.TcpServer.ReturnValue <valueType> > getValue, Func <keyType, AutoCSer.Net.TcpServer.AwaiterBox <valueType> > getValueAwaiter
                    , int maxCount, ILog log = null)
     : base(getLog, getKey, getValue, getValueAwaiter, null, log)
 {
     this.maxCount = Math.Max(maxCount, 1);
     logLock       = new object();
     queue         = new FifoPriorityQueue <RandomKey <keyType>, KeyValue <valueType, EventWaitHandle> >();
     load();
 }
Exemplo n.º 5
0
 /// <summary>
 /// 清除缓存数据
 /// </summary>
 /// <param name="count">保留缓存数据数量</param>
 private static void clearCache(int count)
 {
     Monitor.Enter(domainIpLock);
     try
     {
         if (domainIps.Count != 0)
         {
             domainIps = new FifoPriorityQueue <HashBytes, DomainIPAddress>();
         }
     }
     finally { Monitor.Exit(domainIpLock); }
 }
Exemplo n.º 6
0
 internal void Clear()
 {
     Monitor.Enter(fileLock);
     try
     {
         if (files.Count != 0)
         {
             files = new FifoPriorityQueue <FileCacheKey, FileCache>();
         }
         freeCacheSize = maxCacheSize;
     }
     finally { Monitor.Exit(fileLock); }
 }
Exemplo n.º 7
0
 internal void Clear()
 {
     fileLock.Enter();
     try
     {
         if (files.Count != 0)
         {
             fileLock.SleepFlag = 1;
             files = new FifoPriorityQueue <FileCacheKey, FileCache>();
         }
         freeCacheSize = maxCacheSize;
     }
     finally { fileLock.ExitSleepFlag(); }
 }