Update Redis section of dist caching (#11160)

pull/11213/head
Luke Latham 2019-02-28 14:00:25 -06:00 committed by GitHub
parent 9a0078d304
commit 409fae28bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -134,8 +134,23 @@ The sample app implements <xref:Microsoft.Extensions.Caching.SqlServer.SqlServer
### Distributed Redis Cache
[Redis](https://redis.io/) is an open source in-memory data store, which is often used as a distributed cache. You can use Redis locally, and you can configure an [Azure Redis Cache](https://azure.microsoft.com/services/cache/) for an Azure-hosted ASP.NET Core app. An app configures the cache implementation using a <xref:Microsoft.Extensions.Caching.Redis.RedisCache> instance (<xref:Microsoft.Extensions.DependencyInjection.RedisCacheServiceCollectionExtensions.AddDistributedRedisCache*>):
::: moniker range=">= aspnetcore-2.2"
[Redis](https://redis.io/) is an open source in-memory data store, which is often used as a distributed cache. You can use Redis locally, and you can configure an [Azure Redis Cache](https://azure.microsoft.com/services/cache/) for an Azure-hosted ASP.NET Core app. An app configures the cache implementation using a `RedisCache` instance (`AddStackExchangeRedisCache`):
```csharp
services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "SampleInstance";
});
```
::: moniker-end
::: moniker range="< aspnetcore-2.2"
[Redis](https://redis.io/) is an open source in-memory data store, which is often used as a distributed cache. You can use Redis locally, and you can configure an [Azure Redis Cache](https://azure.microsoft.com/services/cache/) for an Azure-hosted ASP.NET Core app. An app configures the cache implementation using a <xref:Microsoft.Extensions.Caching.Redis.RedisCache> instance (<xref:Microsoft.Extensions.DependencyInjection.RedisCacheServiceCollectionExtensions.AddDistributedRedisCache*>):
```csharp
services.AddDistributedRedisCache(options =>
{
@ -144,6 +159,8 @@ services.AddDistributedRedisCache(options =>
});
```
::: moniker-end
To install Redis on your local machine:
* Install the [Chocolatey Redis package](https://chocolatey.org/packages/redis-64/).