Skip to content

Commit

Permalink
Merge pull request #6798 from umbraco/nucache-settings
Browse files Browse the repository at this point in the history
Added documentation for NuCache JSON Serialization Option
  • Loading branch information
eshanrnh authored Jan 29, 2025
2 parents f4cf2f7 + b00cdee commit d605231
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 24 deletions.
41 changes: 35 additions & 6 deletions 10/umbraco-cms/reference/configuration/nucachesettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -16,15 +18,42 @@ 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.

To use JSON serialization instead of the default MessagePack:

### Using 'Program.cs'

```csharp
builder.Services.Configure<NuCacheSettings>(options =>
{
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
});
```

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

Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
```csharp
{
"Umbraco": {
"CMS": {
"NuCache": {
"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
Expand Down
43 changes: 36 additions & 7 deletions 13/umbraco-cms/reference/configuration/nucachesettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -33,13 +37,38 @@ 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.

To use JSON serialization instead of the default MessagePack:

### Using 'Program.cs'

```csharp
builder.Services.Configure<NuCacheSettings>(options =>
{
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
});
```

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

Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
```csharp
{
"Umbraco": {
"CMS": {
"NuCache": {
"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
Expand Down
43 changes: 36 additions & 7 deletions 14/umbraco-cms/reference/configuration/nucachesettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -33,13 +37,38 @@ 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.

To use JSON serialization instead of the default MessagePack:

### Using 'Program.cs'

```csharp
builder.Services.Configure<NuCacheSettings>(options =>
{
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
});
```

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

Startup duration may increase for larger sites during a "warm boot" but smaller sites should see minimal impact.
```csharp
{
"Umbraco": {
"CMS": {
"NuCache": {
"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
Expand Down
38 changes: 34 additions & 4 deletions 15/umbraco-cms/reference/configuration/cache-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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.

Expand All @@ -182,3 +183,32 @@ 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:

### Using 'Program.cs'

```csharp
builder.Services.Configure<NuCacheSettings>(options =>
{
options.NuCacheSerializerType = NuCacheSerializerType.JSON;
});
```

### Using 'appsettings.json'

```csharp
{
"Umbraco": {
"CMS": {
"NuCache": {
"NuCacheSerializerType": "JSON"
}
}
}
}
```

0 comments on commit d605231

Please sign in to comment.