Franz.Common.Caching
2.3.3
See the version list below for details.
dotnet add package Franz.Common.Caching --version 2.3.3
NuGet\Install-Package Franz.Common.Caching -Version 2.3.3
<PackageReference Include="Franz.Common.Caching" Version="2.3.3" />
<PackageVersion Include="Franz.Common.Caching" Version="2.3.3" />
<PackageReference Include="Franz.Common.Caching" />
paket add Franz.Common.Caching --version 2.3.3
#r "nuget: Franz.Common.Caching, 2.3.3"
#:package Franz.Common.Caching@2.3.3
#addin nuget:?package=Franz.Common.Caching&version=2.3.3
#tool nuget:?package=Franz.Common.Caching&version=2.3.3
Franz.Common.Caching
Caching and performance for the Franz.Common framework on .NET 10.
Overview
The Franz.Common.Caching package provides the caching and performance capability within Franz.Common. It is designed to be composed with the rest of the framework rather than imposing unrelated infrastructure choices on every application.
Installation
dotnet add package Franz.Common.Caching
Design principles
- Explicit composition: register only the capabilities the application needs.
- Clear boundaries: keep domain and application contracts independent from provider-specific infrastructure where the package's role permits it.
- Predictable behavior: make configuration, failure modes, and lifecycle ownership visible rather than relying on hidden conventions.
- Operational readiness: validate security, resilience, diagnostics, and compatibility for the actual deployment environment.
Usage and configuration
Follow the package-specific setup, configuration, and code examples below. Only configure external services when this package requires them, and keep secrets outside source control.
Package-specific guide
Hereβs an updated README for version 1.7.8, including all the observability improvements, metrics observer, logging + metrics observer, and Excel/export-ready observer youβve just implemented:
Franz.Common.Caching
A full-featured caching module for the Franz Framework. Provides unified cache abstractions, hybrid caching (L1 + L2), Mediator request caching, settings cache, and first-class observability via Serilog, OpenTelemetry, and custom metrics/log observers.
- Current Version: v2.3.3
- Target Framework: .NET 10.0
β¨ Features
π§± Unified abstractions
ICacheProviderICacheKeyStrategyISettingsCache- Single cache options model (TTL, sliding, priority, tags)
β‘ Hybrid caching support
- L1: In-memory (fast, local)
- L2: Distributed / Redis (durable, shared)
- Read-through + write-through behavior
- Optional local cache hinting
π§© Pluggable providers
MemoryCacheProviderDistributedCacheProviderRedisCacheProvider
π Flexible cache key strategies
- Default (type + normalized payload)
- Namespaced (domain separation)
- Custom strategies (drop-in)
π Mediator pipeline integration
- Automatic cache HIT / MISS detection
- Transparent response caching
- Per-request cache options (TTL, sliding, bypass)
- CQRS-aware (queries cached, commands skipped)
- Null response caching supported
π Observability out of the box
Serilog enrichment
FranzCorrelationIdFranzCacheKeyFranzCacheHit
OpenTelemetry metrics
- cache hits / misses
- lookup latency
OpenTelemetry trace tags
franz.cache.*
Observers
MetricsCacheObserverβ in-memory metrics, hits, sets, total cache weightLoggingMetricsObserverβ combines Serilog logging + metricsExcelCacheObserverβ export cache statistics (hits, misses, size) to Excel
π Plug-and-play DI extensions
AddFranzMemoryCaching()AddFranzDistributedCaching<T>()AddFranzRedisCaching()AddFranzHybridCaching()AddFranzMediatorCaching()AddObservableCaching()β enables any combination of observersAddLoggingCacheObserver()AddMetricsCacheObserver()AddLoggingMetricsObserver()AddExcelCacheObserver()β opt-in for Excel exports
Observers are opt-in. You can register any combination depending on telemetry/logging needs.
π¦ Installation
dotnet add package Franz.Common.Caching --version 1.7.8
π Quickstart
// Program.cs
builder.Services.AddFranzHybridCaching();
// Mediator caching
builder.Services.AddFranzMediatorCaching(opts =>
{
opts.DefaultTtl = TimeSpan.FromMinutes(10);
opts.ShouldCache = req => !req.GetType().Name.EndsWith("Command");
});
// Observers
builder.Services.AddObservableCaching()
.AddLoggingCacheObserver()
.AddMetricsCacheObserver()
.AddLoggingMetricsObserver()
.AddExcelCacheObserver(); // optional Excel export
π Observability Examples
Metrics Observer
Tracks per-key stats:
- Hits / Misses
- Last access / set time
- Estimated size in bytes
- Total cache weight
var snapshot = metricsObserver.Snapshot();
var totalWeight = snapshot.Values.Sum(x => x.EstimatedSizeBytes);
Logging + Metrics Observer
Combines Serilog logs + OpenTelemetry metrics:
{
"FranzCorrelationId": "af42c6...",
"FranzPipeline": "CachingPipeline",
"FranzCacheKey": "GetUserById:{\"Id\":42}",
"FranzCacheHit": true,
"Message": "Cache HIT for GetUserByIdQuery in 0.6ms"
}
Excel Observer
Exports relevant stats only (hits/misses/size) to Excel for offline analysis.
π Changelog
V2.2.14 - Enhanced Configuration
- Configuration section is now Caching instea "Franz:Caching" for clarity and consistency.
v2.0.1 β Internal Modernization
- Messaging and infrastructure refactored for async, thread-safety, and modern .NET 10 patterns.
- All APIs remain fully backward compatible.
- Tests, listeners, and pipeline components modernized.
1.7.8
- Added MetricsCacheObserver β in-memory hit/miss, per-key stats, total cache weight
- Added LoggingMetricsObserver β combines Serilog + metrics, tracks hits, sets, latency
- Added ExcelCacheObserver β export relevant cache stats to Excel
- Updated DI extensions β opt-in observer registration methods
- Exposed CurrentKeys property on observers for testability
- Observers integrated with Redis, Distributed, Memory caches
- Internal improvements for latency tracking in
CacheAccessDescriptor
1.7.7
- Unified cache options across all providers
- Hybrid cache provider stabilized (L1 + L2)
- Removed legacy entry options
- Provider internals aligned with Mediator pipeline
- Improved null caching semantics
- Documentation refresh
1.7.6
- Lazy infrastructure loading
- Redis startup stability improvements
1.6.20
- Upgraded to .NET 10.0
Perfect β we can make a small ASCII/flow diagram for the README thatβs simple, readable, and shows the cache β observers β outputs flow. Hereβs a suggestion you can drop right under the Observability section:
Cache Operation Flow
-------------------
βββββββββββββββββ
β ICacheProviderβ
βββββββββ¬ββββββββ
β OnCacheSet / OnCacheHit / OnCacheRemove
βΌ
ββββββββββββββββββββββ
β ObservableCacheProvider β
βββββββββ¬βββββββββββββ
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
βββββββββββββ ββββββββββββββββ βββββββββββββββββ
β Logging β β Metrics β β Excel Export β
β Observer β β Observer β β Observer β
βββββββββββββ ββββββββββββββββ βββββββββββββββββ
ICacheProviderβ executes cache operations (set, get, remove).ObservableCacheProviderβ wraps the cache provider and broadcasts to all registered observers.Observers can be:
- LoggingCacheObserver β Serilog / log enrichment
- MetricsCacheObserver β in-memory stats, hits, misses, cache weight
- LoggingMetricsObserver β combined logs + metrics
- ExcelCacheObserver β exports relevant stats to Excel
This makes it instantly clear how any cache action flows through the system and where the data ends up.
If you want, I can also make a slightly fancier Markdown/mermaid diagram that will render nicely on GitHub and looks professional in the README. Do you want me to do that too?
Dependency maintenance β October 2026
EPPlus is upgraded to 8.7.2, which includes fixes for the current System.Security.Cryptography.Xml advisories. Snappier is pinned to patched 1.3.1 and Pkcs to 10.0.13. The intended target framework and public API remain unchanged. Verify the resolved direct and transitive dependency graph through the repository's dependency validation workflow before publishing. See the central dependency upgrade record.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- EPPlus (>= 8.7.2)
- Franz.Common.Mediator (>= 2.3.3)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Caching.Memory (>= 10.0.14)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.14)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.14)
- Snappier (>= 1.3.1)
- StackExchange.Redis (>= 3.0.17)
- System.Security.Cryptography.Pkcs (>= 10.0.13)
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 |
|---|---|---|
| 2.3.4 | 76 | 11/1/2026 |
| 2.3.3 | 260 | 10/28/2026 |
| 2.3.2 | 66 | 10/27/2026 |
| 2.3.1 | 154 | 10/26/2026 |
| 2.3.0 | 170 | 7/21/2026 |
| 2.2.19 | 133 | 7/19/2026 |
| 2.2.18 | 124 | 7/19/2026 |
| 2.2.17 | 127 | 7/12/2026 |
| 2.2.16 | 141 | 7/2/2026 |
| 2.2.15 | 132 | 6/29/2026 |
| 2.2.14 | 127 | 6/29/2026 |
| 2.2.13 | 139 | 6/29/2026 |
| 2.2.12 | 121 | 6/28/2026 |
| 2.2.11 | 124 | 6/28/2026 |
| 2.2.10 | 129 | 6/28/2026 |
| 2.2.9 | 126 | 6/28/2026 |
| 2.2.8 | 119 | 6/28/2026 |
| 2.2.7 | 122 | 6/7/2026 |
| 2.2.6 | 136 | 6/6/2026 |
| 2.2.5 | 137 | 6/4/2026 |