What RedisCacheOptions.InstanceName is needed for?

Viewed 3391

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)?

1 Answers

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

Related