NuCache Settings

Information on the NuCache settings section

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

"Umbraco": {
  "CMS": {
    "NuCache": {
      "BTreeBlockSize": 4096
    }
  }
}

UsePagedSqlQuery

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.

"Umbraco": {
  "CMS": {
    "NuCache": {
      "UsePagedSqlQuery": false
    }
   }
 }

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'

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

Using 'appsettings.json'

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

Additional Settings

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.

public class DisableNuCacheDatabaseComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        var settings = new Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotServiceOptions
        {
            IgnoreLocalDb = true
        };
        builder.Services.AddSingleton(settings);
    }
}

Last updated