MVFC.Pack.Cache
4.0.1
dotnet add package MVFC.Pack.Cache --version 4.0.1
NuGet\Install-Package MVFC.Pack.Cache -Version 4.0.1
<PackageReference Include="MVFC.Pack.Cache" Version="4.0.1" />
<PackageVersion Include="MVFC.Pack.Cache" Version="4.0.1" />
<PackageReference Include="MVFC.Pack.Cache" />
paket add MVFC.Pack.Cache --version 4.0.1
#r "nuget: MVFC.Pack.Cache, 4.0.1"
#:package MVFC.Pack.Cache@4.0.1
#addin nuget:?package=MVFC.Pack.Cache&version=4.0.1
#tool nuget:?package=MVFC.Pack.Cache&version=4.0.1
MVFC.Pack.Cache
Metapackage for distributed cache — Redis via StackExchange and the new .NET Hybrid Cache for flexible L1 (in-memory) / L2 (Redis) strategies.
Motivation
Implementing distributed cache in cloud applications means wiring Redis, aligning it with
.NET's native IDistributedCache abstraction, and deciding between a pure Redis approach
or a two-tier L1/L2 strategy. The new HybridCache in- .NET 9+
solves the stampede problem
and removes the need for custom locking patterns, but it still needs to be properly wired up.
MVFC.Pack.Cache ships all three cache packages together, pinned, so you can choose between pure Redis or Hybrid Cache without any additional dependencies.
Installation
dotnet add package MVFC.Pack.Cache
Quick Start
// Option A — pure Redis
builder.Services.AddStackExchangeRedisCache(options =>
options.Configuration = builder.Configuration.GetConnectionString("Redis"));
// Option B — Hybrid Cache (L1 in-memory + L2 Redis)
builder.Services.AddStackExchangeRedisCache(options =>
options.Configuration = builder.Configuration.GetConnectionString("Redis"));
builder.Services.AddHybridCache(options =>
{
options.DefaultEntryOptions = new HybridCacheEntryOptions
{
Expiration = TimeSpan.FromMinutes(10),
LocalCacheExpiration = TimeSpan.FromMinutes(2)
};
});
// Usage with HybridCache — built-in stampede protection, no manual locking needed
public class ProductService(IHybridCache cache, IProductRepository repo)
{
public async Task<Product?> GetAsync(Guid id, CancellationToken ct)
=> await cache.GetOrCreateAsync(
$"product:{id}",
async token => await repo.GetByIdAsync(id, token),
cancellationToken: ct);
}
Included Packages
| Package | Version |
|---|---|
| StackExchange.Redis | 2.11.3 |
| Microsoft.Extensions.Caching.StackExchangeRedis | 10.0.3 |
| Microsoft.Extensions.Caching.Hybrid | 10.3.0 |
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Caching.Hybrid (>= 10.7.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 10.0.9)
- StackExchange.Redis (>= 3.0.7)
-
net9.0
- Microsoft.Extensions.Caching.Hybrid (>= 9.10.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 9.0.2)
- StackExchange.Redis (>= 3.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.