Exemplo n.º 1
0
 private bool _NeedsCleaning(CacheTotals totals)
 {
     return (totals.TotalQueries > _maxQueries || totals.TotalValues > _maxValues);
 }
Exemplo n.º 2
0
        private bool _Clean(CacheTotals totals)
        {
            bool itemsRemoved = false;

            int totalToRemove = (int)totals.TotalQueries / _reductionFactor;
            itemsRemoved = totalToRemove > 0;
            ICacheEntry[] entries = _cache.EnumerateCache().ToArray();
            Array.Sort(entries);
            _cache.Remove(entries.Take(totalToRemove));

            return itemsRemoved;
        }