Skip to content

Commit 9ab896f

Browse files
authored
Update Distributed Cache Tag Helper content (#36151)
1 parent 75a26bb commit 9ab896f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

aspnetcore/mvc/views/tag-helpers/built-in/distributed-cache-tag-helper.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ author: pkellner
44
description: Learn how to use the Distributed Cache Tag Helper.
55
ms.author: tdykstra
66
ms.custom: mvc
7-
ms.date: 01/24/2020
7+
ms.date: 09/24/2025
88
uid: mvc/views/tag-helpers/builtin-th/distributed-cache-tag-helper
99
---
1010
# Distributed Cache Tag Helper in ASP.NET Core
1111

1212
By [Peter Kellner](https://peterkellner.net)
1313

14-
The Distributed Cache Tag Helper provides the ability to dramatically improve the performance of your ASP.NET Core app by caching its content to a distributed cache source.
14+
The Distributed Cache Tag Helper provides the ability to dramatically improve the performance of your ASP.NET Core app by caching its content to a [distributed cache source](xref:performance/caching/distributed).
1515

1616
For an overview of Tag Helpers, see <xref:mvc/views/tag-helpers/intro>.
1717

1818
The Distributed Cache Tag Helper inherits from the same base class as the Cache Tag Helper. All of the [Cache Tag Helper](xref:mvc/views/tag-helpers/builtin-th/cache-tag-helper) attributes are available to the Distributed Tag Helper.
1919

20-
The Distributed Cache Tag Helper uses [constructor injection](xref:fundamentals/dependency-injection#constructor-injection-behavior). The <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> interface is passed into the Distributed Cache Tag Helper's constructor. If no concrete implementation of `IDistributedCache` is created in `Startup.ConfigureServices` (`Startup.cs`), the Distributed Cache Tag Helper uses the same in-memory provider for storing cached data as the [Cache Tag Helper](xref:mvc/views/tag-helpers/builtin-th/cache-tag-helper).
20+
The Distributed Cache Tag Helper uses [constructor injection](xref:fundamentals/dependency-injection#constructor-injection-behavior). The <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> interface is passed into the Distributed Cache Tag Helper's constructor. If no concrete implementation of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> is created in the `Program` file or `Startup.ConfigureServices` (`Startup.cs`), the Distributed Cache Tag Helper uses the same in-memory provider for storing cached data as the [Cache Tag Helper](xref:mvc/views/tag-helpers/builtin-th/cache-tag-helper).
2121

2222
## Distributed Cache Tag Helper Attributes
2323

@@ -27,13 +27,15 @@ The Distributed Cache Tag Helper uses [constructor injection](xref:fundamentals/
2727
* `expires-on`
2828
* `expires-after`
2929
* `expires-sliding`
30+
* `vary-by`
31+
* `vary-by-cookie`
32+
* `vary-by-culture`
3033
* `vary-by-header`
3134
* `vary-by-query`
3235
* `vary-by-route`
33-
* `vary-by-cookie`
3436
* `vary-by-user`
35-
* `vary-by`
36-
* `priority`
37+
38+
The `expires-sliding` attribute value defaults to 30 seconds if `expires-after` and `expires-on` aren't set. Otherwise, the value defaults to 20 minutes with the SQL Server caching service.
3739

3840
The Distributed Cache Tag Helper inherits from the same class as Cache Tag Helper. For descriptions of these attributes, see the [Cache Tag Helper](xref:mvc/views/tag-helpers/builtin-th/cache-tag-helper).
3941

@@ -53,16 +55,17 @@ Example:
5355
</distributed-cache>
5456
```
5557

56-
## Distributed Cache Tag Helper IDistributedCache implementations
58+
## Distributed Cache Tag Helper `IDistributedCache` implementations
59+
60+
There are two implementations of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> built in to ASP.NET Core. One is based on SQL Server, and the other is based on Redis. Third-party implementations are also available, such as [NCache](http://www.alachisoft.com/ncache/aspnet-core-idistributedcache-ncache.html). Both implementations involve setting an instance of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> in either the `Program` file or `Startup` class.
5761

58-
There are two implementations of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> built in to ASP.NET Core. One is based on SQL Server, and the other is based on Redis. Third-party implementations are also available, such as [NCache](http://www.alachisoft.com/ncache/aspnet-core-idistributedcache-ncache.html). Details of these implementations can be found at <xref:performance/caching/distributed>. Both implementations involve setting an instance of `IDistributedCache` in `Startup`.
62+
There are no tag attributes specifically associated with using any implementation of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache>.
5963

60-
There are no tag attributes specifically associated with using any specific implementation of `IDistributedCache`.
64+
For more information, see <xref:performance/caching/distributed>.
6165

6266
## Additional resources
6367

6468
* <xref:mvc/views/tag-helpers/builtin-th/cache-tag-helper>
6569
* <xref:fundamentals/dependency-injection>
66-
* <xref:performance/caching/distributed>
6770
* <xref:performance/caching/memory>
6871
* <xref:security/authentication/identity>

0 commit comments

Comments
 (0)