user13934953
user13934953

Reputation:

What RedisCacheOptions.InstanceName is needed for?

I'm adding Redis in my ASP.NET Core project and using Microsoft.Extensions.Caching.StackExchangeRedis to set it up (i.e. services.AddStackExchangeRedisCache(opts => ... )). opt is of type RedisCacheOptions, one of properties is the one in question - RedisCacheOptions.InstanceName. I was not able to find a lot of info about it (except that it is Redis instance name) and I'm wondering when it should be set up and what it is used for (right now everything is working on my machine without setting it up)?

Upvotes: 15

Views: 8728

Answers (1)

andy meissner
andy meissner

Reputation: 1322

It seems the instance name can be used if you want to use your cache with multiple apps/services.

If you look into the source code for RedisCache.cs, you see in the constructor a comment describing the usage:

enter image description here

Upvotes: 20

Related Questions