Skip to content

Commit d605231

Browse files
authored
Merge pull request #6798 from umbraco/nucache-settings
Added documentation for NuCache JSON Serialization Option
2 parents f4cf2f7 + b00cdee commit d605231

File tree

4 files changed

+141
-24
lines changed

4 files changed

+141
-24
lines changed

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

+35-6
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,42 @@ 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.
28+
29+
To use JSON serialization instead of the default MessagePack:
30+
31+
### Using 'Program.cs'
32+
33+
```csharp
34+
builder.Services.Configure<NuCacheSettings>(options =>
35+
{
36+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
37+
});
38+
```
2239

23-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
40+
### Using 'appsettings.json'
2441

25-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
42+
```csharp
43+
{
44+
"Umbraco": {
45+
"CMS": {
46+
"NuCache": {
47+
"NuCacheSerializerType": "JSON"
48+
}
49+
}
50+
}
51+
}
52+
```
53+
54+
## Additional Settings
2655

27-
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.
2857

2958
```csharp
3059
public class DisableNuCacheDatabaseComposer : IComposer

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

+36-7
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,38 @@ 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.
43+
44+
To use JSON serialization instead of the default MessagePack:
45+
46+
### Using 'Program.cs'
47+
48+
```csharp
49+
builder.Services.Configure<NuCacheSettings>(options =>
50+
{
51+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
52+
});
53+
```
3754

38-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
55+
### Using 'appsettings.json'
3956

40-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
57+
```csharp
58+
{
59+
"Umbraco": {
60+
"CMS": {
61+
"NuCache": {
62+
"NuCacheSerializerType": "JSON"
63+
}
64+
}
65+
}
66+
}
67+
```
68+
69+
## Additional Settings
4170

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

4473
```csharp
4574
public class DisableNuCacheDatabaseComposer : IComposer

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

+36-7
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,38 @@ 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.
43+
44+
To use JSON serialization instead of the default MessagePack:
45+
46+
### Using 'Program.cs'
47+
48+
```csharp
49+
builder.Services.Configure<NuCacheSettings>(options =>
50+
{
51+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
52+
});
53+
```
3754

38-
It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
55+
### Using 'appsettings.json'
3956

40-
Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
57+
```csharp
58+
{
59+
"Umbraco": {
60+
"CMS": {
61+
"NuCache": {
62+
"NuCacheSerializerType": "JSON"
63+
}
64+
}
65+
}
66+
}
67+
```
68+
69+
## Additional Settings
4170

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

4473
```csharp
4574
public class DisableNuCacheDatabaseComposer : IComposer

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

+34-4
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,32 @@ 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+
### Using 'Program.cs'
194+
195+
```csharp
196+
builder.Services.Configure<NuCacheSettings>(options =>
197+
{
198+
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
199+
});
200+
```
201+
202+
### Using 'appsettings.json'
203+
204+
```csharp
205+
{
206+
"Umbraco": {
207+
"CMS": {
208+
"NuCache": {
209+
"NuCacheSerializerType": "JSON"
210+
}
211+
}
212+
}
213+
}
214+
```

0 commit comments

Comments
 (0)