From 7ade8a3660c0d986157e82a0879c1a95ffff0f36 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 28 Jul 2023 19:05:05 +0200 Subject: [PATCH] Document all options. --- .../Contents/GraphQL/CachingGraphQLResolver.cs | 5 ++--- .../Contents/GraphQL/GraphQLOptions.cs | 2 +- backend/src/Squidex/appsettings.json | 13 +++++++++++++ tools/TestSuite/docker-compose.yml | 6 +++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLResolver.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLResolver.cs index b4ca02731..e66c0325d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLResolver.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLResolver.cs @@ -25,7 +25,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; public sealed class CachingGraphQLResolver : IConfigureExecution { - private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10); private readonly IBackgroundCache cache; private readonly ISchemasHash schemasHash; private readonly IServiceProvider serviceProvider; @@ -68,14 +67,14 @@ public sealed class CachingGraphQLResolver : IConfigureExecution private Task GetModelEntryAsync(IAppEntity app) { - if (options.CacheDuration <= 0) + if (options.CacheDuration <= TimeSpan.Zero) { return CreateModelAsync(app); } var cacheKey = CreateCacheKey(app.Id, app.Version.ToString(CultureInfo.InvariantCulture)); - return cache.GetOrCreateAsync(cacheKey, CacheDuration, async entry => + return cache.GetOrCreateAsync(cacheKey, options.CacheDuration, async entry => { return await CreateModelAsync(app); }, diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLOptions.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLOptions.cs index 7babdaf31..85f2d888b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLOptions.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLOptions.cs @@ -9,7 +9,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; public sealed class GraphQLOptions { - public int CacheDuration { get; set; } = 10 * 60; + public TimeSpan CacheDuration { get; set; } = TimeSpan.FromMinutes(10); public int DataLoaderBatchSize { get; set; } = 1000; diff --git a/backend/src/Squidex/appsettings.json b/backend/src/Squidex/appsettings.json index aa13dda17..d1fd72c0c 100644 --- a/backend/src/Squidex/appsettings.json +++ b/backend/src/Squidex/appsettings.json @@ -306,6 +306,19 @@ "resizerUrl": "" }, + "graphQL": { + // Defines how long the graphl schema is cached. Default: 10 min. + "cacheDuration": "00:10:00", + + // The batch size of the data loader. + // + // HINT: Can be overriden with the X-BatchSize header up to a maximum of 5000. + "dataLoaderBatchSize": 1000, + + // Enables subscriptions. + "enableSubscriptions": true + }, + "logging": { // The log level of the implementation adapter. // diff --git a/tools/TestSuite/docker-compose.yml b/tools/TestSuite/docker-compose.yml index 4f6f7e51f..715ac8e08 100644 --- a/tools/TestSuite/docker-compose.yml +++ b/tools/TestSuite/docker-compose.yml @@ -14,7 +14,7 @@ services: - ASSETS__RESIZERURL=http://resizer - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo - EVENTSTORE__MONGODB__DATABASE=squidex1 - - GRAPHQL__CACHEDURATION=0 + - GRAPHQL__CACHEDURATION=00:00:00 - IDENTITY__ADMINCLIENTID=root - IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0= - IDENTITY__MULTIPLEDOMAINS=true @@ -40,7 +40,7 @@ services: - ASSETS__RESIZERURL=http://resizer - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo - EVENTSTORE__MONGODB__DATABASE=squidex2 - - GRAPHQL__CACHEDURATION=0 + - GRAPHQL__CACHEDURATION=00:00:00 - IDENTITY__ADMINCLIENTID=root - IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0= - IDENTITY__MULTIPLEDOMAINS=true @@ -66,7 +66,7 @@ services: - CONTENTS__OPTIMIZEFORSELFHOSTING=true - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo - EVENTSTORE__MONGODB__DATABASE=squidex3 - - GRAPHQL__CACHEDURATION=0 + - GRAPHQL__CACHEDURATION=00:00:00 - IDENTITY__ADMINCLIENTID=root - IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0= - IDENTITY__MULTIPLEDOMAINS=true