Cirreum.Cache.Hybrid
1.0.4
dotnet add package Cirreum.Cache.Hybrid --version 1.0.4
NuGet\Install-Package Cirreum.Cache.Hybrid -Version 1.0.4
<PackageReference Include="Cirreum.Cache.Hybrid" Version="1.0.4" />
<PackageVersion Include="Cirreum.Cache.Hybrid" Version="1.0.4" />
<PackageReference Include="Cirreum.Cache.Hybrid" />
paket add Cirreum.Cache.Hybrid --version 1.0.4
#r "nuget: Cirreum.Cache.Hybrid, 1.0.4"
#:package Cirreum.Cache.Hybrid@1.0.4
#addin nuget:?package=Cirreum.Cache.Hybrid&version=1.0.4
#tool nuget:?package=Cirreum.Cache.Hybrid&version=1.0.4
Cirreum.Cache.Hybrid
Hybrid caching implementation for Cirreum's cache service
Supersedes the legacy
Cirreum.QueryCache.Hybridpackage. The lineage moved to a new package id alongside the Cirreum 1.0 foundation reset and the code-first caching model.
Overview
Cirreum.Cache.Hybrid provides a hybrid caching implementation that bridges Microsoft's HybridCache service with Cirreum's caching framework.
This library implements the ICacheService interface using Microsoft's HybridCache infrastructure, enabling automatic caching of query results with support for both local and distributed cache layers, tag-based invalidation, and failure-specific expiration policies.
Features
- Hybrid Caching: Leverages Microsoft's
HybridCachefor optimal performance across local and distributed cache layers - Code-First Registration: The
AddHybridCacheService()call is the provider choice — noCacheProviderenum or appsettings switch - One-Call Setup:
AddHybridCacheService()auto-ensures Microsoft'sAddHybridCache(), so the underlying cache is wired up out of the box - Tag-Based Invalidation: Cache invalidation using tags for related data
- Failure Handling: Configurable expiration times for failed operations to prevent cache stampedes
- Result-Aware Caching: Special handling for
IResultresponses with automatic failure detection
Installation
dotnet add package Cirreum.Cache.Hybrid
Usage
Basic Setup
using Cirreum.Cache.Hybrid.Extensions;
// One call: registers the Cirreum bridge AND auto-ensures Microsoft's HybridCache.
services.AddHybridCacheService();
If you need to configure HybridCache (e.g. default entry options, serializers), call
Microsoft's AddHybridCache(...) yourself first — AddHybridCacheService() will detect the
existing registration and leave it untouched:
services.AddHybridCache(options => { /* custom options */ });
services.AddHybridCacheService();
Query Implementation
public record GetUserQuery(int UserId) : ICacheableOperation<User>
{
public CacheExpirationPolicy CacheExpiration => new(
Expiration: TimeSpan.FromMinutes(15),
LocalExpiration: TimeSpan.FromMinutes(5),
FailureExpiration: TimeSpan.FromMinutes(1)
);
public string[] CacheTags => [$"user:{UserId}"];
}
The HybridCacheService automatically handles:
- Cache-or-create patterns
- Failure result caching with shorter expiration
- Tag-based cache invalidation
Versioning
Cirreum.Cache.Hybrid follows Semantic Versioning:
- Major - Breaking API changes
- Minor - New features, backward compatible
- Patch - Bug fixes, backward compatible
License
This project is licensed under the MIT License - see the LICENSE file for details.
Cirreum Foundation Framework Layered simplicity for modern .NET
| 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
- Cirreum.Domain (>= 1.2.5)
- Microsoft.Extensions.Caching.Hybrid (>= 10.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.