Skip to content

Commit ec8b569

Browse files
Add general cache seeding and configuration information
1 parent 0d8d3ce commit ec8b569

File tree

4 files changed

+194
-57
lines changed

4 files changed

+194
-57
lines changed

15/umbraco-cms/extending/creating-custom-seed-key-provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: A guid to creating a custom seed key provider for Umbraco
2+
description: A guide to creating a custom seed key provider for Umbraco
33
---
44

55
# Creating a Custom Seed Key Provider
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
description: Information about cache seeding
3+
---
4+
5+
# Cache Seeding
6+
7+
From version 15 and onwards Umbraco uses a lazy loaded cache, this means content is loaded into the cache on an as-needed basis
8+
I.E. whenever a piece of content is shown on the website for the first time it first needs to be loaded into the cache.
9+
10+
Loading the content into the cache causes a delay. This delay is dependent on the latency between your server and your database, but is generally minimal.
11+
However, for certain pages, for instance the front page, you may not want this delay to be there, the role of cache seeding is to solve this issue.
12+
13+
## How it works
14+
15+
Cache seeding is based upon the concept of a `ISeedKeyProvider`, the role of the seed key provider, is to specify what keys needs to be seeded.
16+
There's two types of seed key providers, a `IDocumentSeedKeyProvider` which specifies which document should be seeded, and a `IMediaSeedKeyProvider` which specifies which media should be seeded.
17+
18+
During startup all the `ISeedKeyProviders` are run, and the keys they return are seeded into their respective caches, `IPublishedContentCache` for documents, and `IPublishedMediaCache` for media.
19+
Additionally whenever a document or media is then later changed, the cache will be updated with the changed content immediately, ensuring the content is always present in the case.
20+
However, here it's important to note, that this means that whenever a piece of content is changed, Umbraco needs to go through the seeded keys to see if it's a piece of seeded content that was updated.
21+
Because of the need the check all seeded keys, Umbraco caches the keys themselves during startup. This means that if you have a dynamic seed key provider, any newly added content won't be considered seeded until the server restarts,
22+
for instance when seeding by document type any new content using the specified document type won't be seeded until a server restart.
23+
24+
## Seed key providers
25+
26+
### Default implementations.
27+
28+
By default, umbraco ships with two seed key providers for documents, and a single one for media.
29+
30+
For documents there is the `ContentTypeSeedKeyProvider` this seeds all documents of the given document types specified through app settings.
31+
32+
For both documents and media there is the `BreadthFirstKeyProvider` this provider does a breadth first traversal of the content and media tree respectively, seeding N number of content specified in the app settings.
33+
34+
Configuration for the default seed key providers can be found in the [cache settings section.](../configuration/cache-settings.md)
35+
36+
### Custom seed key providers
37+
38+
It's also possible to implement your own seed key providers, these are run alongside the default seed key providers on startup.
39+
The returned keys are of all the seed key providers are unioned into a single set, this means that there will be no duplicates, so you don't need to worry consider this.
40+
However, as mentioned above the provided keys are cached, meaning that only the keys returned at startup will be considered seeded until the server restarts and the provider is run again.
41+
42+
For a specific example of how to implement a custom seed key provider, see [Creating a Custom Seed Key Provider](../extending/creating-custom-seed-key-provider.md).
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
description: Information on the Cache settings section
3+
---
4+
5+
# Cache settings
6+
7+
## Seeding settings
8+
9+
The seeding settings allows you to specify which content should be seeded into your cache, for more information on cache seeding see [Cache Seeding.](../cache/cache-seeding.md)
10+
11+
### ContentTypeKeys
12+
13+
The `ContentTypeKeys` setting is used to specify which document types should be seeded into the cache. The setting is a comma-separated list of document type keys.
14+
15+
```json
16+
"Umbraco": {
17+
"CMS": {
18+
"Cache": {
19+
"ContentTypeKeys": ["e811405e-0190-4d3e-8387-7558521eec81", "419e89fb-8cff-4549-a074-9f8a30687828", "e0d71146-8205-4cf4-8236-f982b392259f"],
20+
}
21+
}
22+
}
23+
```
24+
25+
### DocumentBreadthFirstSeedCount
26+
27+
The `DocumentBreadthFirstSeedCount` setting is used to specify how many documents should be seeded into the cache when doing a breadth first traversal, the default value is 100.
28+
29+
30+
```json
31+
"Umbraco": {
32+
"CMS": {
33+
"Cache": {
34+
"DocumentBreadthFirstSeedCount": 500
35+
}
36+
}
37+
}
38+
```
39+
40+
## MediaBreadthFirstSeedCount
41+
42+
The `MediaBreadthFirstSeedCount` setting is used to specify how many media items should be seeded into the cache when doing a breadth first traversal, the default value is 100.
43+
44+
```json
45+
"Umbraco": {
46+
"CMS": {
47+
"Cache": {
48+
"MediaBreadthFirstSeedCount": 500
49+
}
50+
}
51+
}
52+
```
53+
54+
## Cache entry settings
55+
56+
The entry settings allows you to specify how long cache entries should be kept in the cache, the cache entry settings are identical for documents and media.
57+
58+
## LocalCacheDuration
59+
60+
Specifies the duration that cache entries should be kept in the local memory cache, the default value is 24 hours.
61+
62+
```json
63+
"Umbraco": {
64+
"CMS": {
65+
"Cache": {
66+
"Entry": {
67+
"Document": {
68+
"LocalCacheDuration": "2.00:00:00"
69+
},
70+
"Media": {
71+
"LocalCacheDuration": "50.00:00:00"
72+
}
73+
}
74+
}
75+
}
76+
}
77+
```
78+
79+
## RemoteCacheDuration
80+
81+
Specifies the duration that cache entries should be kept in the remote cache, second level cache, this setting is only relevant if second level cache is configured. The default value is 1 year.
82+
83+
```json
84+
"Umbraco": {
85+
"CMS": {
86+
"Cache": {
87+
"Entry": {
88+
"Document": {
89+
"RemoteCacheDuration": "100.00:00:00"
90+
},
91+
"Media": {
92+
"RemoteCacheDuration": "150.00:00:00"
93+
}
94+
}
95+
}
96+
}
97+
}
98+
```
99+
100+
## SeedCacheDuration
101+
102+
Specifies the duration that seeded cache entries should be kept in the cache. The default value is 1 year.
103+
104+
```json
105+
"Umbraco": {
106+
"CMS": {
107+
"Cache": {
108+
"Entry": {
109+
"Document": {
110+
"SeedCacheDuration": "200.00:00:00"
111+
},
112+
"Media": {
113+
"SeedCacheDuration": "250.00:00:00"
114+
}
115+
}
116+
}
117+
}
118+
}
119+
```
120+
121+
# NuCache Settings
122+
123+
For backwards compatibility reasons, certain settings are still located under the `Umbraco:CMS:NuCache` settings node.
124+
125+
## UsePagedSqlQuery
126+
127+
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.
128+
129+
```json
130+
"Umbraco": {
131+
"CMS": {
132+
"NuCache": {
133+
"UsePagedSqlQuery": false
134+
}
135+
}
136+
}
137+
138+
```
139+
## SqlPageSize
140+
141+
Specifying the `SqlPageSize` will change the size of the paged sql queries, by default the value is 1000.
142+
143+
```json
144+
"Umbraco": {
145+
"CMS": {
146+
"NuCache": {
147+
"SqlPageSize": 500
148+
}
149+
}
150+
}
151+
```

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

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)