From 463d60442a5e9b7f525bf87939a2580fed76195f Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Wed, 15 Jan 2025 11:53:19 +0100 Subject: [PATCH 1/2] Added documentation for NuCache JSON Serialization Option --- .../configuration/nucachesettings.md | 26 +++++++++++++---- .../configuration/nucachesettings.md | 28 ++++++++++++++----- .../configuration/nucachesettings.md | 28 ++++++++++++++----- .../reference/configuration/cache-settings.md | 23 ++++++++++++--- 4 files changed, 81 insertions(+), 24 deletions(-) diff --git a/10/umbraco-cms/reference/configuration/nucachesettings.md b/10/umbraco-cms/reference/configuration/nucachesettings.md index 8ba88edc72b..c8bc079d641 100644 --- a/10/umbraco-cms/reference/configuration/nucachesettings.md +++ b/10/umbraco-cms/reference/configuration/nucachesettings.md @@ -4,7 +4,9 @@ description: "Information on the NuCache settings section" # NuCache Settings -This settings section allows you to specify the block size of the BTree used by NuCache. This is configured by default, so you don't need to configure this. However it is possible with something like: +The NuCache settings allow you to configure different aspects of how cached content is stored and retrieved. Below are the details of the available settings and how they can be configured to optimize performance and compatibility with your project needs. + +## BTreeBlockSize ```json "Umbraco": { @@ -16,15 +18,27 @@ This settings section allows you to specify the block size of the BTree used by } ``` -This is how NuCache is configured by default. It is important to mention that the block size must be a power of two, at least 512, and at most 65536 (64K). +{% hint style="info" %} +The block size must be a power of two. It should be at least 512 and at most 65536 (64K). +{% endhint %} -## Additional Settings +## NuCacheSerializerType + +The `NuCacheSerializerType` setting allows developers to specify the serialization format for NuCache content. This setting is particularly relevant for projects migrating from older versions of Umbraco that relied on JSON formats. -It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files. +To use JSON serialization instead of the default MessagePack: -Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. +```csharp +builder.Services.Configure(options => +{ + options.NuCacheSerializerType = NuCacheSerializerType.JSON; +}); + +``` + +## Additional Settings -The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. +You can configure NuCache to work in memory only without reading/writing to the NuCache database files. Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. ```csharp public class DisableNuCacheDatabaseComposer : IComposer diff --git a/13/umbraco-cms/reference/configuration/nucachesettings.md b/13/umbraco-cms/reference/configuration/nucachesettings.md index 378a1be0596..44061fe9dab 100644 --- a/13/umbraco-cms/reference/configuration/nucachesettings.md +++ b/13/umbraco-cms/reference/configuration/nucachesettings.md @@ -4,7 +4,9 @@ description: Information on the NuCache settings section # NuCache Settings -This settings section allows you to specify the block size of the BTree used by NuCache. This is configured by default, so you don't need to configure this. However it is possible with something like: +The NuCache settings allow you to configure different aspects of how cached content is stored and retrieved. Below are the details of the available settings and how they can be configured to optimize performance and compatibility with your project needs. + +## BTreeBlockSize ```json "Umbraco": { @@ -16,11 +18,13 @@ This settings section allows you to specify the block size of the BTree used by } ``` -This is how NuCache is configured by default. It is important to mention that the block size must be a power of two, at least 512, and at most 65536 (64K). +{% hint style="info" %} +The block size must be a power of two. It should be at least 512 and at most 65536 (64K). +{% endhint %} ## UsePagedSqlQuery -Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method instead of the `QueryPaged` method when rebuilding the NuCache files. This will increase performance on bigger Umbraco websites with a lot of content when rebuilding the NuCache. +When `UsePagedSqlQuery` is set to `False`, the `Fetch` method is used instead of the `QueryPaged` method for rebuilding the NuCache files. This will increase performance on larger Umbraco websites with a lot of content when rebuilding the NuCache. ```json "Umbraco": { @@ -33,13 +37,23 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method ``` -## Additional Settings +## NuCacheSerializerType + +The `NuCacheSerializerType` setting allows developers to specify the serialization format for NuCache content. This setting is particularly relevant for projects migrating from older versions of Umbraco that relied on JSON formats. -It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files. +To use JSON serialization instead of the default MessagePack: -Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. +```csharp +builder.Services.Configure(options => +{ + options.NuCacheSerializerType = NuCacheSerializerType.JSON; +}); + +``` + +## Additional Settings -The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. +You can configure NuCache to work in memory only without reading/writing to the NuCache database files. Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. ```csharp public class DisableNuCacheDatabaseComposer : IComposer diff --git a/14/umbraco-cms/reference/configuration/nucachesettings.md b/14/umbraco-cms/reference/configuration/nucachesettings.md index 378a1be0596..44061fe9dab 100644 --- a/14/umbraco-cms/reference/configuration/nucachesettings.md +++ b/14/umbraco-cms/reference/configuration/nucachesettings.md @@ -4,7 +4,9 @@ description: Information on the NuCache settings section # NuCache Settings -This settings section allows you to specify the block size of the BTree used by NuCache. This is configured by default, so you don't need to configure this. However it is possible with something like: +The NuCache settings allow you to configure different aspects of how cached content is stored and retrieved. Below are the details of the available settings and how they can be configured to optimize performance and compatibility with your project needs. + +## BTreeBlockSize ```json "Umbraco": { @@ -16,11 +18,13 @@ This settings section allows you to specify the block size of the BTree used by } ``` -This is how NuCache is configured by default. It is important to mention that the block size must be a power of two, at least 512, and at most 65536 (64K). +{% hint style="info" %} +The block size must be a power of two. It should be at least 512 and at most 65536 (64K). +{% endhint %} ## UsePagedSqlQuery -Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method instead of the `QueryPaged` method when rebuilding the NuCache files. This will increase performance on bigger Umbraco websites with a lot of content when rebuilding the NuCache. +When `UsePagedSqlQuery` is set to `False`, the `Fetch` method is used instead of the `QueryPaged` method for rebuilding the NuCache files. This will increase performance on larger Umbraco websites with a lot of content when rebuilding the NuCache. ```json "Umbraco": { @@ -33,13 +37,23 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method ``` -## Additional Settings +## NuCacheSerializerType + +The `NuCacheSerializerType` setting allows developers to specify the serialization format for NuCache content. This setting is particularly relevant for projects migrating from older versions of Umbraco that relied on JSON formats. -It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files. +To use JSON serialization instead of the default MessagePack: -Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. +```csharp +builder.Services.Configure(options => +{ + options.NuCacheSerializerType = NuCacheSerializerType.JSON; +}); + +``` + +## Additional Settings -The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. +You can configure NuCache to work in memory only without reading/writing to the NuCache database files. Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact. The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer. ```csharp public class DisableNuCacheDatabaseComposer : IComposer diff --git a/15/umbraco-cms/reference/configuration/cache-settings.md b/15/umbraco-cms/reference/configuration/cache-settings.md index ff396b51374..b035830ab03 100644 --- a/15/umbraco-cms/reference/configuration/cache-settings.md +++ b/15/umbraco-cms/reference/configuration/cache-settings.md @@ -151,13 +151,13 @@ Specifies the duration for which seeded cache entries should be kept in the cach } ``` -# NuCache Settings +## NuCache Settings For backward compatibility reasons, certain settings are under the `Umbraco:CMS:NuCache` settings node. -## UsePagedSqlQuery +### UsePagedSqlQuery -Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method instead of the `QueryPaged` method when rebuilding the NuCache files. This will increase performance on bigger Umbraco websites with a lot of content when rebuilding the NuCache. +When `UsePagedSqlQuery` is set to `False`, the `Fetch` method is used instead of the `QueryPaged` method for rebuilding the NuCache files. This will increase performance on larger Umbraco websites with a lot of content when rebuilding the NuCache. ```json "Umbraco": { @@ -169,7 +169,8 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method i } ``` -## SqlPageSize + +### SqlPageSize Specifying the `SqlPageSize` will change the size of the paged SQL queries. The default value is 1000. @@ -182,3 +183,17 @@ Specifying the `SqlPageSize` will change the size of the paged SQL queries. The } } ``` + +## NuCacheSerializerType + +The `NuCacheSerializerType` setting allows developers to specify the serialization format for NuCache content. This setting is particularly relevant for projects migrating from older versions of Umbraco that relied on JSON formats. + +To use JSON serialization instead of the default MessagePack: + +```csharp +builder.Services.Configure(options => +{ + options.NuCacheSerializerType = NuCacheSerializerType.JSON; +}); + +``` From b00cdeeb7e6a115642532be4634a73caceca40ed Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Mon, 27 Jan 2025 13:08:18 +0100 Subject: [PATCH 2/2] Added appsettings.json option --- .../reference/configuration/nucachesettings.md | 15 +++++++++++++++ .../reference/configuration/nucachesettings.md | 15 +++++++++++++++ .../reference/configuration/nucachesettings.md | 15 +++++++++++++++ .../reference/configuration/cache-settings.md | 15 +++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/10/umbraco-cms/reference/configuration/nucachesettings.md b/10/umbraco-cms/reference/configuration/nucachesettings.md index c8bc079d641..5066aac31a0 100644 --- a/10/umbraco-cms/reference/configuration/nucachesettings.md +++ b/10/umbraco-cms/reference/configuration/nucachesettings.md @@ -28,12 +28,27 @@ The `NuCacheSerializerType` setting allows developers to specify the serializati To use JSON serialization instead of the default MessagePack: +### Using 'Program.cs' + ```csharp builder.Services.Configure(options => { options.NuCacheSerializerType = NuCacheSerializerType.JSON; }); +``` +### Using 'appsettings.json' + +```csharp +{ + "Umbraco": { + "CMS": { + "NuCache": { + "NuCacheSerializerType": "JSON" + } + } + } +} ``` ## Additional Settings diff --git a/13/umbraco-cms/reference/configuration/nucachesettings.md b/13/umbraco-cms/reference/configuration/nucachesettings.md index 44061fe9dab..cca6666b9ca 100644 --- a/13/umbraco-cms/reference/configuration/nucachesettings.md +++ b/13/umbraco-cms/reference/configuration/nucachesettings.md @@ -43,12 +43,27 @@ The `NuCacheSerializerType` setting allows developers to specify the serializati To use JSON serialization instead of the default MessagePack: +### Using 'Program.cs' + ```csharp builder.Services.Configure(options => { options.NuCacheSerializerType = NuCacheSerializerType.JSON; }); +``` +### Using 'appsettings.json' + +```csharp +{ + "Umbraco": { + "CMS": { + "NuCache": { + "NuCacheSerializerType": "JSON" + } + } + } +} ``` ## Additional Settings diff --git a/14/umbraco-cms/reference/configuration/nucachesettings.md b/14/umbraco-cms/reference/configuration/nucachesettings.md index 44061fe9dab..cca6666b9ca 100644 --- a/14/umbraco-cms/reference/configuration/nucachesettings.md +++ b/14/umbraco-cms/reference/configuration/nucachesettings.md @@ -43,12 +43,27 @@ The `NuCacheSerializerType` setting allows developers to specify the serializati To use JSON serialization instead of the default MessagePack: +### Using 'Program.cs' + ```csharp builder.Services.Configure(options => { options.NuCacheSerializerType = NuCacheSerializerType.JSON; }); +``` +### Using 'appsettings.json' + +```csharp +{ + "Umbraco": { + "CMS": { + "NuCache": { + "NuCacheSerializerType": "JSON" + } + } + } +} ``` ## Additional Settings diff --git a/15/umbraco-cms/reference/configuration/cache-settings.md b/15/umbraco-cms/reference/configuration/cache-settings.md index b035830ab03..ac31431bb44 100644 --- a/15/umbraco-cms/reference/configuration/cache-settings.md +++ b/15/umbraco-cms/reference/configuration/cache-settings.md @@ -190,10 +190,25 @@ The `NuCacheSerializerType` setting allows developers to specify the serializati To use JSON serialization instead of the default MessagePack: +### Using 'Program.cs' + ```csharp builder.Services.Configure(options => { options.NuCacheSerializerType = NuCacheSerializerType.JSON; }); +``` + +### Using 'appsettings.json' +```csharp +{ + "Umbraco": { + "CMS": { + "NuCache": { + "NuCacheSerializerType": "JSON" + } + } + } +} ```