/// <summary> /// Initializes a new instance of the <see cref="QueryPlanCacheMiddleware{TSchema}" /> class. /// </summary> /// <param name="schema">The schema.</param> /// <param name="keyManager">The key manager.</param> /// <param name="cacheProvider">The cache provider.</param> public QueryPlanCacheMiddleware(TSchema schema, IGraphQueryPlanCacheKeyManager keyManager, IGraphQueryPlanCacheProvider cacheProvider) { Validation.ThrowIfNull(schema, nameof(schema)); _cacheOptions = schema.Configuration.QueryCacheOptions; _keyManager = keyManager; _cacheProvider = cacheProvider; }
/// <summary> /// Merges the specified configuration setttings into this instance. /// </summary> /// <param name="config">The configuration.</param> public void Merge(ISchemaQueryPlanCacheConfiguration config) { if (config == null) { return; } this.TimeToLiveInMilliseconds = config.TimeToLiveInMilliseconds; this.SlidingExpiration = config.SlidingExpiration; }
/// <summary> /// Initializes a new instance of the <see cref="SchemaConfiguration" /> class. /// </summary> /// <param name="declarationOptions">The declaration options to build the configuration with.</param> /// <param name="executionOptions">The execution options to build the configuration with.</param> /// <param name="responseOptions">The response options to build the configuration with.</param> /// <param name="cacheOptions">The cache options to build this configuration with.</param> public SchemaConfiguration( ISchemaDeclarationConfiguration declarationOptions = null, ISchemaExecutionConfiguration executionOptions = null, ISchemaResponseConfiguration responseOptions = null, ISchemaQueryPlanCacheConfiguration cacheOptions = null) { _declarationOptions = new SchemaDeclarationConfiguration(); _executionOptions = new SchemaExecutionConfiguration(); _responseOptions = new SchemaResponseConfiguration(); _cacheOptions = new SchemaQueryPlanCacheConfiguration(); _declarationOptions.Merge(declarationOptions); _executionOptions.Merge(executionOptions); _responseOptions.Merge(responseOptions); _cacheOptions.Merge(cacheOptions); }