The Couchbase.Extensions (GitHub) project aims to make working with Couchbase Server and .NET Core simpler. Caching is just one of these extensions.

You can add it to your ASP.NET Core project with NuGet, via Package Manager: Install-Package Couchbase.Extensions.Caching -Version 1.0.0-beta2 , or with the NuGet UI, or you can use the .NET command line: dotnet add package Couchbase.Extensions.Caching --version 1.0.0-beta2 .

Once you’ve added this to your project, you’ll need to make a couple minor changes to your Startup class in Startup.cs .

First, in ConfigureServices , add a couple namespaces:

using Couchbase.Extensions.Caching; using Couchbase.Extensions.DependencyInjection; 1 2 using Couchbase . Extensions . Caching ; using Couchbase . Extensions . DependencyInjection ;

This will make the Caching namespace available, and specifically the AddDistributedCouchbaseCache extension method for IServiceCollection . Next, call that extension method from within the ConfigureServices method.

The other namespace in there, DependencyInjection , is necessary to inject Couchbase functionality. In this case, it’s going to be used only by the Caching extension. But you can use it for other purposes too, which I will cover in a future blog post.

But for now, it’s just needed for the AddCouchbase extension method on IServiceCollection .

Finally, put them both together, and your ConfigureServices method should look like this: