Пример #1
0
        public async Task <T> GetAsync <T>(string key, Func <Task <T> > loader)
        {
            if (!_options.Enabled)
            {
                return(await loader());
            }

            return(await _cache.GetOrCreateAsync(key, entry =>
            {
                entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(_options.SmallMemoryCache.DurationSeconds);
                return loader();
            }));
        }