Beispiel #1
0
 public CacheBlock GetCache(string key)
 {
     lock (Locker)
     {
         return(CachePool.Get(key));
     }
 }
 public static void RunTask(Action task, Action callback)
 {
     lock (CacheArgs)
         CacheArgs.Enqueue(ArgCache.Get().SetVal(task, callback));
     if (!isRunning)
     {
         Run();
     }
 }
Beispiel #3
0
 protected override void OnUpdate()
 {
     semaphore.WaitOne();
     lock (CacheArgs)
     {
         while (CacheArgs.Count != 0)
         {
             RunningArgs.Enqueue(CacheArgs.Dequeue());
         }
     }
     while (RunningArgs.Count != 0)
     {
         Interlocked.Increment(ref ThreadCount);
         ThreadCache.Get().RunTask(RunningArgs.Dequeue());
     }
 }
 private static void ThreadLoop()
 {
     while (true)
     {
         eve.WaitOne();
         lock (CacheArgs)
         {
             while (CacheArgs.Count != 0)
             {
                 RunningArgs.Enqueue(CacheArgs.Dequeue());
             }
         }
         while (RunningArgs.Count != 0)
         {
             ThreadCache.Get().RunTask(RunningArgs.Dequeue());
         }
         Thread.Sleep(5);
         Stop();
     }
 }
Beispiel #5
0
 public void CacheTableRegisterTest()
 {
     //注册缓存表
     _pool.Register <TestTable>();
     Assert.IsNotNull(_pool.Get <TestTable>());
 }