Danny Barack
Danny Barack

Reputation: 159

Work with specified Redis DB instance in Asp Net Core

My Redis DB has many instances (db0, db1, db2 ...). I am using each instance for for different environments.

I configured distributed cache object to as following:

services.AddDistributedRedisCache(options =>
    {
        options.Configuration = "localhost";
        options.InstanceName = "SampleInstance";
    });

With the StackExchange.Redis I could get the db. How do I do it here ?

Upvotes: 1

Views: 2720

Answers (1)

Danny Barack
Danny Barack

Reputation: 159

I found the answer here:
https://stackexchange.github.io/StackExchange.Redis/Configuration

In the follwoing example I work with the 'db7' instance:

services.AddDistributedRedisCache(options =>
    {
        options.Configuration = "localhost, defaultDatabase=7";
    }); 

Upvotes: 1

Related Questions