public void Refresh() { if (_cachingOptions.TimeToLive != default) { var newOptions = new CachingOptions <T>( _cachingOptions.TimeToLive.Value, _cachingOptions.OnRemove); _cachingOptions = newOptions; } }
public Task SetAsync <T>(string key, T value, CachingOptions <T> options = null) { Set(key, value, options); return(Task.FromResult(0)); }
public void Set <T>(string key, T value, CachingOptions <T> options = null) { var item = new CachedItem <T>(value, options); _cache[key] = item; }
public void UpdateExpiration(DateTime expiration) { var newOptions = new CachingOptions <T>(expiration, _cachingOptions.OnRemove); _cachingOptions = newOptions; }
public CachedItem(T item, CachingOptions <T> cachingOptions = null) { Item = item; _cachingOptions = cachingOptions ?? CachingOptions.NoExpiration <T>(); }