Franz.Common.Caching
1.6.15
dotnet add package Franz.Common.Caching --version 1.6.15
NuGet\Install-Package Franz.Common.Caching -Version 1.6.15
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="Franz.Common.Caching" Version="1.6.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.Caching" Version="1.6.15" />
<PackageReference Include="Franz.Common.Caching" />
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 Franz.Common.Caching --version 1.6.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Franz.Common.Caching, 1.6.15"
#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 Franz.Common.Caching@1.6.15
#: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=Franz.Common.Caching&version=1.6.15
#tool nuget:?package=Franz.Common.Caching&version=1.6.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Franz.Common.Caching
A full-featured caching module for the** Franz Framework**.
Provides pluggable cache providers(Memory, Distributed, Redis), request caching via Mediator pipelines, settings cache, and built-in observability with Serilog + OpenTelemetry.
- Current Version: 1.6.15
? Features
- ?? ** Unified abstractions**:
ICacheProvider
,ICacheKeyStrategy
,ISettingsCache
. - ?? ** Multiple providers out of the box**:
MemoryCacheProvider
(fast local)DistributedCacheProvider
(SQL Server, NCache, etc.)RedisCacheProvider
(scalable distributed caching).
- ?? ** Flexible key strategies**:
- Default(type + serialized payload)
- Namespaced(domain separation)
- Custom(plug in your own).
- ?? ** Mediator pipeline**:
- Automatic cache HIT/MISS detection
- Transparent response caching
- Per-request TTL + bypass
- Consistent with CQRS(cache queries, skip commands).
- ?? ** Observability out of the box**:
- Enriched Serilog logs(
FranzCorrelationId
,FranzCacheKey
, etc.) - OpenTelemetry** metrics**: hits, misses, lookup latency
- OpenTelemetry** trace tags**:
franz.cache.*
- Enriched Serilog logs(
- ?? ** Plug-and-play DI extensions**:
AddFranzMemoryCaching()
AddFranzDistributedCaching<T>()
AddFranzRedisCaching()
(connection string or DI factory)AddFranzMediatorCaching()
.
?? Installation
dotnet add package Franz.Common.Caching
? Quickstart
// Program.cs
builder.Services.AddFranzCaching(); // defaults to in-memory
builder.Services.AddFranzMediatorCaching(opts =>
{
opts.DefaultTtl = TimeSpan.FromMinutes(10);
opts.ShouldCache = req => !req.GetType().Name.EndsWith("Command");
});
Example Mediator Query
public record GetUserByIdQuery(int Id) : IQuery<User>;
*First execution ? MISS ? fetch + cache
- Subsequent executions with same input ? HIT ? return cached response
Logs and telemetry are produced automatically.
?? Providers
In-memory
services.AddFranzMemoryCaching();
Distributed (SQL Server, NCache, etc.)
services.AddFranzDistributedCaching<SqlServerCache>();
Redis
// Simple
services.AddFranzRedisCaching("localhost:6379");
// Advanced (DI-driven)
services.AddFranzRedisCaching(sp =>
{
var cfg = sp.GetRequiredService<IConfiguration>();
return ConnectionMultiplexer.Connect(cfg.GetConnectionString("Redis"));
});
?? Observability
Serilog Logs
{
"FranzCorrelationId": "af42c6...",
"FranzPipeline": "CachingPipeline",
"FranzCacheKey": "GetUserById:{\"Id\":42}",
"FranzCacheHit": true,
"Message": "Cache HIT for GetUserByIdQuery in 0.6ms"
}
OpenTelemetry Metrics
franz_cache_hits
franz_cache_misses
franz_cache_lookup_latency_ms
OpenTelemetry Trace Tags
franz.cache.key
franz.cache.hit
franz.cache.ttl_seconds
?? Roadmap
- Support for hashed cache keys (short keys for Redis).
- More built-in strategies (e.g., sliding expiration).
- Deeper integration with
Franz.Common.Settings
.
Franz.Common.Caching is production-ready:
? Cache providers + Mediator integration + observability, all out of the box.
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 was computed. 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.
-
net9.0
- Franz.Common.Mediator (>= 1.6.15)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Caching.Memory (>= 9.0.9)
- StackExchange.Redis (>= 2.9.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.