private CacheControlFeature( CacheControlKey key) { ResourceKey = key; CacheControlSupported = false; ValidationSupported = false; CacheControlResponseHeaders = new Dictionary <string, StringValues>(); }
internal static ICacheControlFeature CacheUnsupported( [DisallowNull] CacheControlKey key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } return(new CacheControlFeature(key)); }
private CacheControlFeature( CacheContentValidators?validators, IDictionary <string, StringValues> headers, CacheControlKey key) { ResourceKey = key; ValidationSupported = true; CacheControlSupported = true; CacheControlResponseHeaders = headers; Validators = validators; }
public async Task <CacheContentValidators?> TryGetCacheControlResponseAsync( CacheControlKey key) { if (key == null) { throw new ArgumentNullException(nameof(key)); } var result = await distributedCache.GetStringAsync(key.Key); return(result == null ? null : JsonSerializer.Deserialize <CacheContentValidators>(result)); }
internal static ICacheControlFeature CacheDisabled( [DisallowNull] CacheControlKey key, [DisallowNull] IDictionary <string, StringValues> headers) { if (key is null) { throw new ArgumentNullException(nameof(key)); } if (headers is null) { throw new ArgumentNullException(nameof(headers)); } return(new CacheControlFeature(headers, key)); }
//TODO: this can probably be called from decorator on infrastructure layer public Task SetCacheControlResponseAsync( CacheControlKey key, CacheContentValidators response) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (response == null) { throw new ArgumentNullException(nameof(response)); } var str = JsonSerializer.Serialize(response); return(distributedCache.SetStringAsync(key.Key, str)); }
protected Task <CacheContentValidators?> TryGetCacheControlValidators(CacheControlKey key) { return(cacheControlStore.TryGetCacheControlResponseAsync(key)); }