public static CacheEntryOptions Clone(this CacheEntryOptions options) { var cloneOptions = Create(); cloneOptions.CreatedUtc = options.CreatedUtc; cloneOptions.ExpirationMode = options.ExpirationMode; cloneOptions.ExpirationTimeout = options.ExpirationTimeout; return(cloneOptions); }
public static CacheEntryOptions Timeout(this CacheEntryOptions options, TimeSpan timeout) { if (timeout < TimeSpan.Zero) { timeout = TimeSpan.Zero; } options.ExpirationTimeout = timeout; return(options); }
public virtual Task SetAsync <TValue>(string key, TValue value, CacheEntryOptions options, string region) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } var cacheEntry = new CacheEntry <string, TValue>(key, region, value, options); return(SetAsync(cacheEntry)); }
public virtual void Set <TValue>(TKey key, TValue value, CacheEntryOptions options, string region) { if (key == null) { throw new ArgumentNullException(nameof(key)); } var cacheEntry = new CacheEntry <TKey, TValue>(key, region, value, options); Set(cacheEntry); }
public CacheEntry(TKey key, string region, TValue value, CacheEntryOptions options) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } Key = key; Region = region; Value = value; Options = options; }
public Task SetAsync <TValue>(string key, TValue value, CacheEntryOptions options, string region) { Set <TValue>(key, value, options, region); return(CompletedTask); }
public void Set <TValue>(string key, TValue value, CacheEntryOptions options, string region) { _localCacheProvider.Set <TValue>(key, value, options, region); }
public Task SetAsync <TValue>(string key, TValue value, CacheEntryOptions options) { return(SetAsync <TValue>(key, value, options, null)); }
public void Set <TValue>(TKey key, TValue value, CacheEntryOptions options) { Set(key, value, options, null); }