![]() |
VOOZH | about |
dotnet add package CodeCargo.Nats.DistributedCache --version 0.2.0
NuGet\Install-Package CodeCargo.Nats.DistributedCache -Version 0.2.0
<PackageReference Include="CodeCargo.Nats.DistributedCache" Version="0.2.0" />
<PackageVersion Include="CodeCargo.Nats.DistributedCache" Version="0.2.0" />Directory.Packages.props
<PackageReference Include="CodeCargo.Nats.DistributedCache" />Project file
paket add CodeCargo.Nats.DistributedCache --version 0.2.0
#r "nuget: CodeCargo.Nats.DistributedCache, 0.2.0"
#:package CodeCargo.Nats.DistributedCache@0.2.0
#addin nuget:?package=CodeCargo.Nats.DistributedCache&version=0.2.0Install as a Cake Addin
#tool nuget:?package=CodeCargo.Nats.DistributedCache&version=0.2.0Install as a Cake Tool
👁 CodeCargo.Nats.DistributedCache
👁 CodeCargo.Nats.HybridCacheExtensions
A .NET 8+ library for using NATS with HybridCache or as an IDistributedCache directly.
LimitMarkerTTL set for per-key TTL support. Example:
// assuming an INatsConnection natsConnection
var kvContext = natsConnection.CreateKeyValueStoreContext();
await kvContext.CreateOrUpdateStoreAsync(new NatsKVConfig("cache") { LimitMarkerTTL = TimeSpan.FromSeconds(1) });
HybridCacheThe CodeCargo.Nats.HybridCacheExtensions package provides an extension method that:
IDistributedCacheHybridCacheHybridCache to use the NATS Connection's serializer registrydotnet add package CodeCargo.Nats.HybridCacheExtensions
dotnet add package NATS.Net
using CodeCargo.Nats.HybridCacheExtensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NATS.Client.Core;
using NATS.Client.Hosting;
using NATS.Client.KeyValueStore;
using NATS.Net;
const string natsUrl = "nats://localhost:4222";
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices(services =>
{
services.AddNats(configureOpts: options => options with { Url = natsUrl });
services.AddNatsHybridCache(options =>
{
options.BucketName = "cache";
});
});
var host = builder.Build();
var natsConnection = host.Services.GetRequiredService<INatsConnection>();
var kvContext = natsConnection.CreateKeyValueStoreContext();
await kvContext.CreateOrUpdateStoreAsync(new NatsKVConfig("cache")
{
LimitMarkerTTL = TimeSpan.FromSeconds(1)
});
await host.RunAsync();
IDistributedCache Directlydotnet add package CodeCargo.Nats.DistributedCache
dotnet add package NATS.Net
using CodeCargo.Nats.DistributedCache;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NATS.Client.Core;
using NATS.Client.Hosting;
using NATS.Client.KeyValueStore;
using NATS.Net;
const string natsUrl = "nats://localhost:4222";
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices(services =>
{
services.AddNats(configureOpts: options => options with { Url = natsUrl });
services.AddNatsDistributedCache(options =>
{
options.BucketName = "cache";
});
});
var host = builder.Build();
var natsConnection = host.Services.GetRequiredService<INatsConnection>();
var kvContext = natsConnection.CreateKeyValueStoreContext();
await kvContext.CreateOrUpdateStoreAsync(new NatsKVConfig("cache")
{
LimitMarkerTTL = TimeSpan.FromSeconds(1)
});
await host.RunAsync();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on CodeCargo.Nats.DistributedCache:
| Package | Downloads |
|---|---|
|
CodeCargo.Nats.HybridCacheExtensions
Extensions for using HybridCache with NATS. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.0-preview.3 | 1,699 | 12/24/2025 |
| 0.3.0-preview.2 | 1,587 | 5/26/2025 |
| 0.3.0-preview.1 | 186 | 5/25/2025 |
| 0.2.0 | 1,070 | 5/19/2025 |
| 0.2.0-preview.1 | 197 | 5/19/2025 |
| 0.1.2 | 245 | 5/16/2025 |
| 0.1.1 | 272 | 5/16/2025 |
| 0.1.0 | 283 | 5/12/2025 |