public void CacheScavengingWithPerformanceCountersEnabledDoesUpdateCounters() { ICachingInstrumentationProvider provider = new CachingInstrumentationProvider(instanceName, true, false, formatter); provider.FireCacheScavenged(10); Assert.AreEqual(10L, cacheScavengedItemsCounter.RawValue); }
public void MultipleCacheScavengingsWithPerformanceCountersEnabledDoesUpdateCounters() { ICachingInstrumentationProvider provider = new CachingInstrumentationProvider(instanceName, true, false, formatter); for (int i = 1; i <= 10; i++) { provider.FireCacheScavenged(10); } Assert.AreEqual(100L, cacheScavengedItemsCounter.RawValue); }
private void RemoveScavengableItems(SortedList scavengableItems) { int scavengedItemCount = 0; foreach (CacheItem scavengableItem in scavengableItems.Values) { bool wasRemoved = RemoveItemFromCache(scavengableItem); if (wasRemoved) { scavengedItemCount++; if (scavengedItemCount == NumberOfItemsToBeScavenged) { break; } } } instrumentationProvider.FireCacheScavenged(scavengedItemCount); }