コード例 #1
0
        /// <inheritdoc />
        public async Task <CacheStatusResult> ExecuteAsync(
            GetCacheStatusOp operation)
        {
            var syncResult = this.Execute(operation);
            var result     = await Task.FromResult(syncResult);

            return(result);
        }
コード例 #2
0
        /// <inheritdoc />
        public CacheStatusResult Execute(
            GetCacheStatusOp operation)
        {
            lock (this.syncCache)
            {
                UtcDateTimeRangeInclusive dateRangeOfCachedObjectsUtc = null;
                if (this.operationToCacheResultMap.Any())
                {
                    var minFreshness = this.operationToCacheResultMap.Values.Min(_ => _.FreshnessInUtc);
                    var maxFreshness = this.operationToCacheResultMap.Values.Max(_ => _.FreshnessInUtc);
                    dateRangeOfCachedObjectsUtc = new UtcDateTimeRangeInclusive(minFreshness, maxFreshness);
                }

                var result = new CacheStatusResult(this.operationToCacheResultMap.Count, dateRangeOfCachedObjectsUtc);
                return(result);
            }
        }