Exemple #1
0
 public void Schedule(Evictor task, TimeSpan delay, TimeSpan period)
 {
     this.ThrowIfDisposed();
     if (task == null)
     {
         return;
     }
     lock (typeof(EvictionTimer))
     {
         if (_taskMap.TryGetValue(task, out Timer timer))
         {
             timer.Change(delay, period);
         }
         else
         {
             var t = new Timer(state => task.Run(), null, delay, period);
             _taskMap[task] = t;
         }
     }
 }