Example #1
0
 public bool TryGetValue(string key, out Parser parser)
 {
     if (this.parsers.TryGetValue(key, out parser))
     {
         this.parserAccessDates[key] = DateTime.UtcNow;
         return true;
     }
     return false;
 }
Example #2
0
 public bool TryGetValue(string key, out Parser parser)
 {
     if (this.parsers.TryGetValue(key, out parser))
     {
         this.parserAccessDates[key] = DateTime.UtcNow;
         return(true);
     }
     return(false);
 }
Example #3
0
 public void Add(string key, Parser parser)
 {
     this.parsers[key] = parser;
     this.parserAccessDates[key] = DateTime.UtcNow;
     // If we exceed the maximum amount of parsers, remove the oldest ones
     if (this.parsers.Count > GlobalHost.MaxParsers)
     {
         var toBeRemoved = this.parserAccessDates.OrderBy(x => x.Value).Take(GlobalHost.ParsersToRemoveOnOverflow).ToList();
         DateTime dummyDateTime;
         Parser dummyParser;
         foreach (var entry in toBeRemoved)
         {
             this.parserAccessDates.TryRemove(entry.Key, out dummyDateTime);
             this.parsers.TryRemove(entry.Key, out dummyParser);
         }
     }
 }
Example #4
0
 public void Add(string key, Parser parser)
 {
     this.parsers[key]           = parser;
     this.parserAccessDates[key] = DateTime.UtcNow;
     // If we exceed the maximum amount of parsers, remove the oldest ones
     if (this.parsers.Count > GlobalHost.MaxParsers)
     {
         var      toBeRemoved = this.parserAccessDates.OrderBy(x => x.Value).Take(GlobalHost.ParsersToRemoveOnOverflow).ToList();
         DateTime dummyDateTime;
         Parser   dummyParser;
         foreach (var entry in toBeRemoved)
         {
             this.parserAccessDates.TryRemove(entry.Key, out dummyDateTime);
             this.parsers.TryRemove(entry.Key, out dummyParser);
         }
     }
 }