Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 15/umbraco-cms/reference/cache/examples/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,20 @@ namespace Doccers.Core.Controllers.Api;

public class TagsController : UmbracoApiController
{
private readonly ICacheTagService _tagService;
private readonly ICacheTagService _cacheTagService;

// Dependency injection rocks!
public TagsController(ICacheTagService tagService)
public TagsController(ICacheTagService cacheTagService)
{
_tagService = tagService;
_cacheTagService = cacheTagService;
}

[HttpGet]
public IEnumerable<TagModel> GetDefaultTags()
{
// As mentioned earlier we want tags from "default"
// group to be cached for a minute.
return _tagService.GetAll("default", "defaultTags",
return _cacheTagService.GetAll("default", "defaultTags",
TimeSpan.FromMinutes(1));
}

Expand All @@ -148,7 +148,7 @@ public class TagsController : UmbracoApiController
// If you don't specify a TimeSpan the object(s)
// will be cached until manually removed or
// if the site restarts.
return _tagService.GetAll("blog", "blogTags");
return _cacheTagService.GetAll("blog", "blogTags");
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Although the use of a GUID is preferable, you can also use it's numeric ID:

```csharp
// Get a reference to the content type by its numeric ID
IContentType contentType = _contentTypeService.Get(1234);
IContentType contentType = _contentTypeService.Get(1234);
```

Finally, you can also look up a content type by its alias:
Expand All @@ -41,19 +41,18 @@ As content types are stored in a hierarchical list with folders (containers), th
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll();
```

In the example above, the method was called without any parameters. The method also has two overloads, which lets you look up a collection fo content types by either specifying their GUID or numeric IDs:

The service also have `GetMany`-methods to get a collection of content types by their GUIDs IDs or numeric IDs:
```csharp
// Get a collection of two specific content types by their GUIDs IDs
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll(new[] {
IEnumerable<IContentType> contentTypes = _contentTypeService.GetMany(new[] {
new Guid("2b54088e-d355-4b9e-aa4b-5aec4b3f87eb"),
new Guid("859c5916-19d8-4a72-9bd0-5641ad503aa9")
});
```

```csharp
// Get a collection of two specific content types by their numeric IDs
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll(1234, 1235);
IEnumerable<IContentType> contentTypes = _contentTypeService.GetMany(1234, 1235);
```

To get a list of all Content Types of another content type, you can use the `GetChildren` method. This can be done by specifying the numeric ID or the GUID:
Expand Down
Loading