예제 #1
0
파일: PageCache.cs 프로젝트: sgww/cozy
 public CacheBlock GetCache(string key)
 {
     lock (Locker)
     {
         return(CachePool.Get(key));
     }
 }
예제 #2
0
 public static void RunTask(Action task, Action callback)
 {
     lock (CacheArgs)
         CacheArgs.Enqueue(ArgCache.Get().SetVal(task, callback));
     if (!isRunning)
     {
         Run();
     }
 }
예제 #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());
     }
 }
예제 #4
0
 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();
     }
 }
예제 #5
0
 public void CacheTableRegisterTest()
 {
     //注册缓存表
     _pool.Register <TestTable>();
     Assert.IsNotNull(_pool.Get <TestTable>());
 }