
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
Couchbase.Extensions.Caching
Advanced tools
A custom ASP.NET Core Middleware plugin for distributed cache using Couchbase server as the backing store. Supports both Memcached (in-memory) and Couchbase (persistent) buckets.
A custom ASP.NET Core Middleware plugin for a distributed cache using Couchbase server as the backing store. Supports both Ephemeral (in-memory) and Couchbase (persistent) buckets.
Assuming you have an installation of Couchbase Server and Visual Studio (examples with VSCODE forthcoming), do the following:
In Setup.cs add the following to the ConfigureServices method:
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
services.AddCouchbase(opt =>
{
opt.ConnectionString = "couchbase://localhost";
opt.UserName = "Administrator";
opt.Password = "password";
});
services.AddDistributedCouchbaseCache(opt => {
opt.BucketName = "cache";
opt.ScopeName = "my_service";
opt.CollectionName = "my_collection";
});
}
You can change the localhost hostname to wherever you are hosting your Couchbase cluster.
In your controller add a parameter for ICouchbaseCache or IDistributedCache to the constructor.
Using IDistributedCache will allow persistence of byte[] to the cache. ICouchbaseCache extends
this functionality with additional methods for storing and retrieving typed objects.
public class HomeController : Controller
{
private ICouchbaseCache _cache;
public HomeController(ICouchbaseCache cache)
{
_cache = cache;
}
public async Task<IActionResult> Index()
{
await _cache.SetAsync("CacheTime", DateTimeOffset.Now);
return View();
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page. "
+ (await _cache.GetAsync<DateTimeOffset>("CacheTime"));
return View();
}
}
For performance reasons, we strongly recommend using the Async overloads and not the synchronous methods on IDistributeCache.
Any type you persist in the cache will be transcoded and serialized using the transcoder and serializer
configured in the call to AddCouchbase. By default, this is the JsonTranscoder and the DefaultSerializer
which uses Newtonsoft.Json. However, setting and getting byte[] is always transcoded as raw binary regardless
of the configured transcoder.
FAQs
A custom ASP.NET Core Middleware plugin for distributed cache using Couchbase server as the backing store. Supports both Memcached (in-memory) and Couchbase (persistent) buckets.
We found that couchbase.extensions.caching demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.