private MemoryCacheEntryOptions GetMemoryCacheEntryOptions(CacheEntryOptions options) { if (options?.Expiration == null) { return(new MemoryCacheEntryOptions() .SetSlidingExpiration(_cacheExpiration)); } return(new MemoryCacheEntryOptions() .SetSlidingExpiration(options.Expiration.Value)); }
public Task SetAsync(object key, object value, CacheEntryOptions options = null) { Set(key, value, options); return(Task.CompletedTask); }
public void Set(object key, object value, CacheEntryOptions options = null) { var cacheEntryOptions = GetMemoryCacheEntryOptions(options); _memoryCache.Set(key, value, cacheEntryOptions); }