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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MVFC.Pack.Cache" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.Pack.Cache" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MVFC.Pack.Cache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MVFC.Pack.Cache --version 4.0.1
                    
#r "nuget: MVFC.Pack.Cache, 4.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MVFC.Pack.Cache@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MVFC.Pack.Cache&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MVFC.Pack.Cache&version=4.0.1
                    
Install as a Cake Tool

MVFC.Pack.Cache

🇧🇷 Leia em Português · ← Back to MVFC.Pack

License Platform NuGet Version NuGet Downloads

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

Apache-2.0

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1 235 6/26/2026
4.0.0 298 4/8/2026
3.0.3 307 3/20/2026
2.0.1 330 2/23/2026
2.0.0 340 2/23/2026
1.0.3 324 2/23/2026