Skip to content

Commit

Permalink
Merge pull request umbraco#4463 from umbraco/AddNuCacheSettingsForV8
Browse files Browse the repository at this point in the history
Add V8 version of Nucache settings
  • Loading branch information
sofietoft authored Oct 17, 2022
2 parents 90886dc + 07b5b0f commit 60a2d31
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
48 changes: 48 additions & 0 deletions Reference/Configuration-for-Umbraco-7-and-8/nucache-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
versionFrom: 8.6.0
versionTo: 9.0.0
meta.Title: "Umbraco NuCache Settings"
meta.Description: "Information on the NuCache settings section"
---

# NuCache Settings

NuCache uses the BPlusTree library for storing the cache of published content. It has a default 'block' size for where data is stored in memory. It is possible for a Umbraco content item to have a footprint that is too large. In these cases, it will cause an error when being stored in the BPlusTree block. In these circumstances it is possible to configure BPlusTree to use larger size blocks.

Add the following AppSetting to your `web.config` file:

```xml
<appSettings>
<add key="Umbraco.Web.PublishedCache.NuCache.BTree.BlockSize" value="4096" />
</appSettings>
```

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).

## Additional Settings

It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.

For larger sites this is likely to increase startup duration for a "warm boot". However, for a smaller site there should be little to no impact.

This is configurable by adding the following composer:

```csharp
public class DisableNuCacheDatabaseComposer : IComposer
{
public void Compose(Composition composition)
{
var settings = new Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotServiceOptions
{
IgnoreLocalDb = true
};
composition.Register(factory => settings, Lifetime.Singleton);
}
}
```

:::note
The example above applies to Umbraco 8.6+.

Are you using Umbraco 9+ or later versions, please refer to the article on [NuCache Settings for Umbraco 9+](../Configuration/NuCacheSettings/).
:::
7 changes: 6 additions & 1 deletion Reference/Configuration/NuCacheSettings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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).


## Additional Settings

It is possible to configure NuCache to work in memory only without reading/writing the NuCache database files.
Expand All @@ -43,3 +42,9 @@ public class DisableNuCacheDatabaseComposer : IComposer
}
}
```

:::note
The example above applies only to Umbraco 9+ sites.

Are you using Umbraco 8, please refer to the article on [NuCache Settings for Umbraco 8](../../Configuration-for-Umbraco-7-and-8/nucache-settings.md).
:::

0 comments on commit 60a2d31

Please sign in to comment.