Skip to content

Commit 463d604

Browse files
committed
Added documentation for NuCache JSON Serialization Option
1 parent 8fda0e6 commit 463d604

File tree

4 files changed

+81
-24
lines changed

4 files changed

+81
-24
lines changed

10/umbraco-cms/reference/configuration/nucachesettings.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: "Information on the NuCache settings section"
44

55
# NuCache Settings
66

7-
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:
7+
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.
8+
9+
## BTreeBlockSize
810

911
```json
1012
"Umbraco": {
@@ -16,15 +18,27 @@ This settings section allows you to specify the block size of the BTree used by
1618
}
1719
```
1820

19-
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).
21+
{% hint style="info" %}
22+
The block size must be a power of two. It should be at least 512 and at most 65536 (64K).
23+
{% endhint %}
2024

21-
## Additional Settings
25+
## NuCacheSerializerType
26+
27+
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.
2228

23-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
29+
To use JSON serialization instead of the default MessagePack:
2430

25-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
31+
```csharp
32+
builder.Services.Configure<NuCacheSettings>(options =>
33+
{
34+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
35+
});
36+
37+
```
38+
39+
## Additional Settings
2640

27-
The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer.
41+
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.
2842

2943
```csharp
3044
public class DisableNuCacheDatabaseComposer : IComposer

13/umbraco-cms/reference/configuration/nucachesettings.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: Information on the NuCache settings section
44

55
# NuCache Settings
66

7-
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:
7+
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.
8+
9+
## BTreeBlockSize
810

911
```json
1012
"Umbraco": {
@@ -16,11 +18,13 @@ This settings section allows you to specify the block size of the BTree used by
1618
}
1719
```
1820

19-
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).
21+
{% hint style="info" %}
22+
The block size must be a power of two. It should be at least 512 and at most 65536 (64K).
23+
{% endhint %}
2024

2125
## UsePagedSqlQuery
2226

23-
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.
27+
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.
2428

2529
```json
2630
"Umbraco": {
@@ -33,13 +37,23 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method
3337

3438
```
3539

36-
## Additional Settings
40+
## NuCacheSerializerType
41+
42+
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.
3743

38-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
44+
To use JSON serialization instead of the default MessagePack:
3945

40-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
46+
```csharp
47+
builder.Services.Configure<NuCacheSettings>(options =>
48+
{
49+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
50+
});
51+
52+
```
53+
54+
## Additional Settings
4155

42-
The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer.
56+
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.
4357

4458
```csharp
4559
public class DisableNuCacheDatabaseComposer : IComposer

14/umbraco-cms/reference/configuration/nucachesettings.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: Information on the NuCache settings section
44

55
# NuCache Settings
66

7-
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:
7+
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.
8+
9+
## BTreeBlockSize
810

911
```json
1012
"Umbraco": {
@@ -16,11 +18,13 @@ This settings section allows you to specify the block size of the BTree used by
1618
}
1719
```
1820

19-
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).
21+
{% hint style="info" %}
22+
The block size must be a power of two. It should be at least 512 and at most 65536 (64K).
23+
{% endhint %}
2024

2125
## UsePagedSqlQuery
2226

23-
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.
27+
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.
2428

2529
```json
2630
"Umbraco": {
@@ -33,13 +37,23 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method
3337

3438
```
3539

36-
## Additional Settings
40+
## NuCacheSerializerType
41+
42+
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.
3743

38-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
44+
To use JSON serialization instead of the default MessagePack:
3945

40-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
46+
```csharp
47+
builder.Services.Configure<NuCacheSettings>(options =>
48+
{
49+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
50+
});
51+
52+
```
53+
54+
## Additional Settings
4155

42-
The settings have not yet been exposed via the new configuration setup, instead you must configure with a composer.
56+
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.
4357

4458
```csharp
4559
public class DisableNuCacheDatabaseComposer : IComposer

15/umbraco-cms/reference/configuration/cache-settings.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ Specifies the duration for which seeded cache entries should be kept in the cach
151151
}
152152
```
153153

154-
# NuCache Settings
154+
## NuCache Settings
155155

156156
For backward compatibility reasons, certain settings are under the `Umbraco:CMS:NuCache` settings node.
157157

158-
## UsePagedSqlQuery
158+
### UsePagedSqlQuery
159159

160-
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.
160+
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.
161161

162162
```json
163163
"Umbraco": {
@@ -169,7 +169,8 @@ Setting `UsePagedSqlQuery` to `False` your project will use the `Fetch` method i
169169
}
170170

171171
```
172-
## SqlPageSize
172+
173+
### SqlPageSize
173174

174175
Specifying the `SqlPageSize` will change the size of the paged SQL queries. The default value is 1000.
175176

@@ -182,3 +183,17 @@ Specifying the `SqlPageSize` will change the size of the paged SQL queries. The
182183
}
183184
}
184185
```
186+
187+
## NuCacheSerializerType
188+
189+
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.
190+
191+
To use JSON serialization instead of the default MessagePack:
192+
193+
```csharp
194+
builder.Services.Configure<NuCacheSettings>(options =>
195+
{
196+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
197+
});
198+
199+
```

0 commit comments

Comments
 (0)