Exemple #1
0
        public CacheManager()
        {
            // Make sure a Cache directory exists
            if (!Directory.Exists("Cache"))
            {
                Directory.CreateDirectory("Cache");
            }

            InstrumentCaches = new List <InstrumentCache>();

            Tasks      = new LinkedList <CacheTask>();
            TaskAtHand = null;
        }
Exemple #2
0
 /// <summary>
 /// Starts running the next task in the list
 /// </summary>
 public void StartNextTask()
 {
     lock (TasksLock)
     {
         if (TaskAtHand != null)
         {
             Tasks.Remove(TaskAtHand);
         }
         if (Tasks.Count > 0)
         {
             TaskAtHand = Tasks.First.Value;
         }
         else
         {
             TaskAtHand = null;
         }
     }
     TaskAtHand?.Start();
 }
Exemple #3
0
 public void AddNonurgentTask(CacheTask cacheTask)
 {
     Tasks.AddLast(cacheTask);
 }
Exemple #4
0
 /// <summary>
 /// Adds a task that is needed urgently.
 /// </summary>
 /// <param name="cacheTask"></param>
 public void AddUrgentTask(CacheTask cacheTask)
 {
     Tasks.AddFirst(cacheTask);
 }