private bool _NeedsCleaning(CacheTotals totals) { return (totals.TotalQueries > _maxQueries || totals.TotalValues > _maxValues); }
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; }