public void SetUp()
        {
            _itemLookedUp = null;
            _metrics = new CachedItemMetrics("", new object());

            _updaterMock = RMM.GenerateStrictMock<IWebRequestCacheMetricsUpdater>();
            RME.Stub(_updaterMock, x => x.Increment_Cache_LongTermLookup());
            RME.Stub(_updaterMock, x => x.Increment_Cache_LongTermHits());
            RME.Stub(_updaterMock, x => x.Increment_Cache_LongTermMisses());
        }
Пример #2
0
        /// <summary>
        /// Will update the metrics when an item is looked up in volatile cache.
        /// </summary>
        /// <param name="item">The item that was loaded from cache.  Null implies a miss.</param>
        /// <param name="webRequestMetrics">The web request object for tracking thread performance.</param>
        internal void OnItemVolatileCacheLookedUp(object item, IWebRequestCacheMetricsUpdater metricsUpdator)
        {
            metricsUpdator.Increment_Cache_VolatileLookup();
            Interlocked.Increment(ref _volatileCacheLookUps);

            if (item == null)
            {
                metricsUpdator.Increment_Cache_VolatileMisses();
                Interlocked.Increment(ref _volatileCacheMisses);
            }
            else
            {
                metricsUpdator.Increment_Cache_VolatileHits();
                Interlocked.Increment(ref _volatileCacheHits);
            }
        }
Пример #3
0
        /// <summary>
        /// Will update the metrics when an item is looked up in long term cache.
        /// </summary>
        /// <param name="item">The item that was loaded from cache.  Null implies a miss.</param>
        /// <param name="webRequestMetrics">The web request object for tracking thread performance.</param>
        internal void OnItemLongTermCacheLookedUp(object item, IWebRequestCacheMetricsUpdater metricsUpdator)
        {
            metricsUpdator.Increment_Cache_LongTermLookup();
            Interlocked.Increment(ref _longTermCacheLookUps);

            if (item == null)
            {
                metricsUpdator.Increment_Cache_LongTermMisses();
                Interlocked.Increment(ref _longTermCacheMisses);
            }
            else
            {
                metricsUpdator.Increment_Cache_LongTermHits();
                Interlocked.Increment(ref _longTermCacheHits);
            }
        }