Exemple #1
0
        /// <summary>
        ///     清空缓存。
        /// </summary>
        public virtual void Clear()
        {
            var cacheKeys = _cache.Select(m => m.Key).ToList();

            foreach (var cacheKey in cacheKeys)
            {
                _cache.Remove(cacheKey);
            }
        }
 private IList<LoggingEventCacheItem> GetPreviousOccurrences(MemoryCache cache, LoggingEvent loggingEvent)
 {
     return cache.Select(x => x.Value)
         .Cast<LoggingEventCacheItem>()
         .Where(e =>
             e.LoggingEvent.RenderedMessage == loggingEvent.RenderedMessage
             && e.LoggingEvent.Level == loggingEvent.Level)
         .ToList();
 }
 private IList<EmailLogEntry> GetPreviousOccurrences(MemoryCache cache, LogEntry logEntry)
 {
     return cache.Select(x => x.Value).Cast<EmailLogEntry>()
         .Where(e => e.LogEntry.Message == logEntry.Message)
         .ToList();
 }