title: Using IDistributedCache and Redis in ASP.NET 5/MVC 6 - type or namespace 'Microsoft.Caching' does not exist
body: <p>I am experimenting with the utilization of Redis cache in MVC 6 but I can't get my project to build.</p>
  
  <p>I followed the examples at <a href="https://github.com/aspnet/Caching/tree/dev/samples" rel="nofollow">https://github.com/aspnet/Caching/tree/dev/samples</a> - there is an IDistributedCache sample and a Redis sample.  However, it's not entirely clear because the Redis sample isn't a web app.</p>
  
  <p>I have this in my project.json dependencies:</p>
  
  <pre><code>    "Microsoft.Framework.Cache.Memory": "1.0.0-beta3",
      "Microsoft.Framework.Caching.Distributed": "1.0.0-*",
      "Microsoft.Framework.Caching.Redis": "1.0.0-*",
  </code></pre>
  
  <p>I used this to get my packages:</p>
  
  <blockquote>
    <p>kpm install Microsoft.Framework.Caching.Distributed</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>kpm install Microsoft.Framework.Caching.Redis</p>
  </blockquote>
  
  <p>Both commands worked and returned an OK.</p>
  
  <p>And in my startup I'm trying the following:</p>
  
  <pre><code> services.AddSingleton&lt;IMemoryCache, MemoryCache&gt;();
   services.AddSingleton&lt;IDistributedCache, RedisCache&gt;();
  </code></pre>
  
  <p>When trying to build or run, the error given is:</p>
  
  <blockquote>
    <p>Startup.cs(10,27): error CS0234: The type or namespace name 'Caching'
    does not exist in the namespace 'Microsoft.Framework' (are you missing
    an assembly reference?) Startup.cs(11,27): error CS0234: The type or
    namespace name 'Caching' does not exist in the namespace
    'Microsoft.Framework' (are you missing an assembly reference?)
    Startup.cs(25,35): error CS0246: The type or namespace name
    'IDistributedCache' could not be found (are you missing a using
    directive or an assembly reference?) Startup.cs(25,54): error CS0246:
    The type or namespace name 'RedisCache' could not be found (are you
    missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Now obviously I have the wrong references - but what are the right references?  I'm copying the namespaces directly from the samples?  I tried switching to Microsoft.Cache.Distributed and that didn't work either (and conflicted with github)</p>
  
  <p>I have a feeling this is to do with not having the correct K version and maybe that's the way out - upgrading to the latest version.  There is a mismatch between Framework.Cache.Memory and Framework.Cache.Distributed and I see github comments relating to namespace changes.</p>
  
  <p>If anyone can point the way out of this maze, much appreciated.</p>