title: ASP.NET Core 2 - Multiple Azure Redis Cache services DI
body: <p>In ASP.NET Core 2 we can add a Azure Redis Cache like this:</p>
  
  <pre><code> services.AddDistributedRedisCache(config =&gt;
   {
      config.Configuration = Configuration.GetConnectionString("RedisCacheConnection");
      config.InstanceName = "MYINSTANCE";
   });
  </code></pre>
  
  <p>Then the usage will be like this:</p>
  
  <pre><code>private readonly IDistributedCache _cache;
  
  public MyController(IDistributedCache cache)
  {
     _cache = cache;
  }
  </code></pre>
  
  <p>How can I do it so that I will have:</p>
  
  <pre><code>private readonly IDistributedCache _cache1;
  private readonly IDistributedCache _cache2;
  
  public MyController(IDistributedCache cache1, IDistributedCache cache2)
  {
     _cache1 = cache1;
     _cache2 = cache2;
  }
  </code></pre>
  
  <p>My questions how can I add another service that points to a different Azure Redis Cache Connection and instance and make separation of them when I want to use them?</p>