예제 #1
0
        /// <summary>
        /// Logs cache purge activity
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="purgeObservable">The purge observable.</param>
        /// <param name="itemsPurged">The items purged.</param>
        private static void ReportPurge(ILogger logger, IPurgeObservable purgeObservable, int itemsPurged)
        {
            if (!logger.IsEnabled(LogLevel.Debug))
            {
                return;
            }
            int itemCountAfterPurge  = purgeObservable.ItemCount;
            var itemCountBeforePurge = itemCountAfterPurge + itemsPurged;

            if (itemCountAfterPurge == 0)
            {
                logger.LogDebug("BlockPurged: cache empty");
            }
            logger.LogDebug("BlockPurged: PurgeCount: {PurgeCount}, CacheSize: {ItemCountAfterPurge}", itemCountBeforePurge - itemCountAfterPurge, itemCountAfterPurge);
        }
        /// <summary>
        /// Logs cache purge activity
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="purgeObservable"></param>
        /// <param name="itemsPurged"></param>
        private static void ReportPurge(Logger logger, IPurgeObservable <TCachedMessage> purgeObservable, int itemsPurged)
        {
            if (!logger.IsVerbose)
            {
                return;
            }
            int itemCountAfterPurge  = purgeObservable.ItemCount;
            var itemCountBeforePurge = itemCountAfterPurge + itemsPurged;

            if (itemCountAfterPurge == 0)
            {
                logger.Verbose("BlockPurged: cache empty");
            }
            logger.Verbose($"BlockPurged: PurgeCount: {itemCountBeforePurge - itemCountAfterPurge}, CacheSize: {itemCountAfterPurge}");
        }