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: aspnetcore/performance/caching/distributed.md
+32-4Lines changed: 32 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,12 @@ description: Learn how to use an ASP.NET Core distributed cache to improve app p
5
5
monikerRange: '>= aspnetcore-2.1'
6
6
ms.author: riande
7
7
ms.custom: mvc
8
-
ms.date: 08/27/2019
8
+
ms.date: 01/22/2020
9
9
uid: performance/caching/distributed
10
10
---
11
11
# Distributed caching in ASP.NET Core
12
12
13
-
By [Luke Latham](https://github.com/guardrex) and [Steve Smith](https://ardalis.com/)
13
+
By [Luke Latham](https://github.com/guardrex), [Mohsin Nasir](https://github.com/mohsinnasir), and [Steve Smith](https://ardalis.com/)
14
14
15
15
A distributed cache is a cache shared by multiple app servers, typically maintained as an external service to the app servers that access it. A distributed cache can improve the performance and scalability of an ASP.NET Core app, especially when the app is hosted by a cloud service or a server farm.
16
16
@@ -34,6 +34,8 @@ To use a SQL Server distributed cache, add a package reference to the [Microsoft
34
34
35
35
To use a Redis distributed cache, add a package reference to the [Microsoft.Extensions.Caching.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Extensions.Caching.StackExchangeRedis) package.
36
36
37
+
To use NCache distributed cache, add a package reference to the [NCache.Microsoft.Extensions.Caching.OpenSource](https://www.nuget.org/packages/NCache.Microsoft.Extensions.Caching.OpenSource) package.
38
+
37
39
::: moniker-end
38
40
39
41
::: moniker range="= aspnetcore-2.2"
@@ -42,6 +44,8 @@ To use a SQL Server distributed cache, reference the [Microsoft.AspNetCore.App m
42
44
43
45
To use a Redis distributed cache, reference the [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app) and add a package reference to the [Microsoft.Extensions.Caching.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Extensions.Caching.StackExchangeRedis) package. The Redis package isn't included in the `Microsoft.AspNetCore.App` package, so you must reference the Redis package separately in your project file.
44
46
47
+
To use NCache distributed cache, reference the [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app) and add a package reference to the [NCache.Microsoft.Extensions.Caching.OpenSource](https://www.nuget.org/packages/NCache.Microsoft.Extensions.Caching.OpenSource) package. The NCache package isn't included in the `Microsoft.AspNetCore.App` package, so you must reference the NCache package separately in your project file.
48
+
45
49
::: moniker-end
46
50
47
51
::: moniker range="< aspnetcore-2.2"
@@ -50,6 +54,8 @@ To use a SQL Server distributed cache, reference the [Microsoft.AspNetCore.App m
50
54
51
55
To use a Redis distributed cache, reference the [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app) and add a package reference to the [Microsoft.Extensions.Caching.Redis](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Redis) package. The Redis package isn't included in the `Microsoft.AspNetCore.App` package, so you must reference the Redis package separately in your project file.
52
56
57
+
To use NCache distributed cache, reference the [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app) and add a package reference to the [NCache.Microsoft.Extensions.Caching.OpenSource](https://www.nuget.org/packages/NCache.Microsoft.Extensions.Caching.OpenSource) package. The NCache package isn't included in the `Microsoft.AspNetCore.App` package, so you must reference the NCache package separately in your project file.
58
+
53
59
::: moniker-end
54
60
55
61
## IDistributedCache interface
@@ -68,6 +74,7 @@ Register an implementation of <xref:Microsoft.Extensions.Caching.Distributed.IDi
* Install the [Chocolatey Redis package](https://chocolatey.org/packages/redis-64/).
172
-
* Run `redis-server` from a command prompt.
178
+
1. Install the [Chocolatey Redis package](https://chocolatey.org/packages/redis-64/).
179
+
1. Run `redis-server` from a command prompt.
180
+
181
+
### Distributed NCache Cache
182
+
183
+
[NCache](https://github.com/Alachisoft/NCache) is an open source in-memory distributed cache developed natively in .NET and .NET Core. NCache works both locally and configured as a distributed cache cluster for an ASP.NET Core app running in Azure or on other hosting platforms.
184
+
185
+
To install and configure NCache on your local machine, see [NCache Getting Started Guide for Windows](https://www.alachisoft.com/resources/docs/ncache-oss/getting-started-guide-windows/).
186
+
187
+
To configure NCache:
188
+
189
+
1. Install [NCache open source NuGet](https://www.nuget.org/packages/Alachisoft.NCache.OpenSource.SDK/).
190
+
1. Configure the cache cluster in [client.ncconf](https://www.alachisoft.com/resources/docs/ncache-oss/admin-guide/client-config.html).
191
+
1. Add the following code to `Startup.ConfigureServices`:
0 commit comments