示例#1
0
        public void CacheScavengingWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            ICachingInstrumentationProvider provider
                = new CachingInstrumentationProvider(instanceName, true, false, formatter);

            provider.FireCacheScavenged(10);

            Assert.AreEqual(10L, cacheScavengedItemsCounter.RawValue);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
        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);
        }
        public void CacheScavengingWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            ICachingInstrumentationProvider provider
                = new CachingInstrumentationProvider(instanceName, true, false, formatter);

            provider.FireCacheScavenged(10);

            Assert.AreEqual(10L, cacheScavengedItemsCounter.RawValue);
        }