Skip to content

Commit 6d45f44

Browse files
Apply suggestions from code review
Co-authored-by: sofietoft <[email protected]>
1 parent ab35a91 commit 6d45f44

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ description: A guide to creating a custom seed key provider for Umbraco
44

55
# Creating a Custom Seed Key Provider
66

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

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

1311
{% 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.
1513
{% endhint %}
1614

1715
## Implementation
1816

1917
This example implements a `IDocumentSeedKeyProvider` which seeds all the children of a node, in this case blog posts.
2018

21-
First we'll create a class called `BlogSeedKeyProvider` that implements `IDocumentSeedKeyProvider`.
19+
1. Create a new class called `BlogSeedKeyProvider` that implements `IDocumentSeedKeyProvider`.
2220

2321
```csharp
2422
using Umbraco.Cms.Infrastructure.HybridCache;
@@ -51,7 +49,9 @@ public class BlogSeedKeyProvider : IDocumentSeedKeyProvider
5149
{...}
5250
```
5351

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`.
5555

5656
```csharp
5757
public ISet<Guid> GetSeedKeys()
@@ -66,7 +66,7 @@ public ISet<Guid> GetSeedKeys()
6666
return new HashSet<Guid>();
6767
}
6868
```
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.
7070

7171
The final class looks like this:
7272

@@ -99,7 +99,7 @@ public class BlogSeedKeyProvider : IDocumentSeedKeyProvider
9999

100100
### Registering the Seed Key Provider
101101

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

104104
```csharp
105105
using MySite.SeedKeyProviders;
@@ -112,4 +112,4 @@ builder.Services.AddSingleton<IDocumentSeedKeyProvider, BlogSeedKeyProvider>();
112112
{...}
113113
```
114114

115-
Now all our blogpost will be seeded into the cache on startup, and will always be present in the cache.
115+
All blogpost will now be seeded into the cache on startup, and will always be present in the cache.

15/umbraco-cms/reference/cache/cache-seeding.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ description: Information about cache seeding
44

55
# Cache Seeding
66

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

109
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.
1211

1312
## How it works
1413

0 commit comments

Comments
 (0)