public void PurgeStop(Context context, PurgeResult result)
        {
            if (_eventSource.IsEnabled())
            {
                _eventSource.PurgeStop(result.Succeeded, result.ErrorMessage, result.EvictedSize, result.EvictedFiles, result.PinnedSize);
            }

            _purgeCallCounter.Completed(result.Duration.Ticks);

            if (context.IsEnabled)
            {
                TracerOperationFinished(context, result, $"{Name}.Purge stop {result.DurationMs}ms result=[{result}]");
            }
        }
Example #2
0
        /// <summary>
        ///     Merge in results from another purge.
        /// </summary>
        public void Merge(PurgeResult result)
        {
            VisitedFiles += result.VisitedFiles;
            EvictedSize  += result.EvictedSize;
            EvictedFiles += result.EvictedFiles;
            PinnedSize   += result.PinnedSize;

            _quotaDescription ??= result._quotaDescription;
            StopReason ??= result.StopReason;

            if (result._reserveSize != null)
            {
                _reserveSize = result._reserveSize + (_reserveSize ?? 0);
            }

            if (result._hashesToPurgeCount != null)
            {
                _hashesToPurgeCount = result._hashesToPurgeCount + (_hashesToPurgeCount ?? 0);
            }
        }