You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 15/umbraco-cms/extending/creating-custom-seed-key-provider.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,19 @@ description: A guide to creating a custom seed key provider for Umbraco
4
4
5
5
# Creating a Custom Seed Key Provider
6
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
-
However, you may some specific content to always be in the cache, to achieve this you can implement your own custom seed key providers.
7
+
Umbraco uses a lazy loaded cache, which means that content is loaded into the cache on an as-needed basis. However, you may need specific content to always be in the cache. To achieve this you can implement your own custom seed key providers.
9
8
10
-
There is two types of seed key providers: `IDocumentSeedKeyProvider` for documents and `IMediaSeedKeyProvider` for media,
11
-
these interfaces are identical so only `IDocumentSeedKeyProvider` is demonstrated here.
9
+
There are two types of seed key providers: `IDocumentSeedKeyProvider` for documents and `IMediaSeedKeyProvider` for media. As these interfaces are identical only `IDocumentSeedKeyProvider` is demonstrated in this article.
12
10
13
11
{% hint style="warning" %}
14
-
Seed keys are themselves cached and only calculated once, this means that any documents created after the site has started won't be included in the seed keys untill ther server has restarted.
12
+
Seed keys are cached and calculated once. Any documents created after the site has started will not be included in the seed keys until after a server restart.
15
13
{% endhint %}
16
14
17
15
## Implementation
18
16
19
17
This example implements a `IDocumentSeedKeyProvider` which seeds all the children of a node, in this case blog posts.
20
18
21
-
First we'll create a class called `BlogSeedKeyProvider` that implements `IDocumentSeedKeyProvider`.
19
+
1. Create a new class called `BlogSeedKeyProvider` that implements `IDocumentSeedKeyProvider`.
22
20
23
21
```csharp
24
22
usingUmbraco.Cms.Infrastructure.HybridCache;
@@ -51,7 +49,9 @@ public class BlogSeedKeyProvider : IDocumentSeedKeyProvider
51
49
{...}
52
50
```
53
51
54
-
Now we can parse a hardcoded string to a guid and use the `IDocumentNavigationQueryService` to get the children of the blog node and return their keys as a `HashSet`.
52
+
3. Parse a hardcoded string to a GUID.
53
+
4. Use the `IDocumentNavigationQueryService` to get the children of the blog node.
54
+
5. Return their keys as a `HashSet`.
55
55
56
56
```csharp
57
57
publicISet<Guid>GetSeedKeys()
@@ -66,7 +66,7 @@ public ISet<Guid> GetSeedKeys()
66
66
returnnewHashSet<Guid>();
67
67
}
68
68
```
69
-
We since we're returning it as a set, and all the sets gets unioned, we don't have to worry about duplicates.
69
+
Since this returns it as a set, and all the sets get unioned, we do not have to worry about duplicates.
70
70
71
71
The final class looks like this:
72
72
@@ -99,7 +99,7 @@ public class BlogSeedKeyProvider : IDocumentSeedKeyProvider
99
99
100
100
### Registering the Seed Key Provider
101
101
102
-
Now that we have implemented the `BlogSeedKeyProvider`we need to register it in the `Startup` class.
102
+
Now that the `BlogSeedKeyProvider`is implemented, it must be registered in the `Startup` class.
Copy file name to clipboardExpand all lines: 15/umbraco-cms/reference/cache/cache-seeding.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,10 @@ description: Information about cache seeding
4
4
5
5
# Cache Seeding
6
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
-
that is whenever a piece of content is shown on the website for the first time it first needs to be loaded into the cache.
7
+
Umbraco uses a lazy loaded cache, meaning content is loaded into the cache on an as-needed basis. Whenever a piece of content is shown on the website for the first time it first needs to be loaded into the cache.
9
8
10
9
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.
10
+
For certain pages, like the front page, you may not want this delay to be there. The role of cache seeding is meant to solve this issue.
0 commit comments