CoreSystem.Cache
1.1.0
dotnet add package CoreSystem.Cache --version 1.1.0
NuGet\Install-Package CoreSystem.Cache -Version 1.1.0
<PackageReference Include="CoreSystem.Cache" Version="1.1.0" />
<PackageVersion Include="CoreSystem.Cache" Version="1.1.0" />
<PackageReference Include="CoreSystem.Cache" />
paket add CoreSystem.Cache --version 1.1.0
#r "nuget: CoreSystem.Cache, 1.1.0"
#:package CoreSystem.Cache@1.1.0
#addin nuget:?package=CoreSystem.Cache&version=1.1.0
#tool nuget:?package=CoreSystem.Cache&version=1.1.0
⚡ CoreSystem.Cache
Production-ready distributed caching framework for .NET 8
CoreSystem.Cache extends the standard .NET caching abstractions with a production-ready execution pipeline, automatic Redis fallback, cache rehydration, HTTP response caching, OpenTelemetry metrics, health checks, and tag-based invalidation.
✨ Features
- ✅ Memory and Redis providers
- ✅ Cache-Aside (
GetOrAddAsync) - ✅ Tag-based invalidation
- ✅ Automatic Redis → Memory fallback
- ✅ Automatic cache rehydration
- ✅ HTTP response caching
- ✅ OpenTelemetry metrics
- ✅ ASP.NET Core Health Checks
- ✅ Polly resilience integration
- ✅ JSON, MessagePack and Protocol Buffers serialization
📦 Installation
dotnet add package CoreSystem.Cache
🚀 Quick Start
Register the framework:
builder.Services.AddCoreCache(options =>
{
options.Redis.Configuration = redis =>
{
redis.EndPoints.Add("localhost:6379");
};
});
Inject the cache service:
public sealed class ProductService(ICoreCache cache)
{
}
Store data:
await cache.SetAsync(
"products:1",
product,
TimeSpan.FromMinutes(10));
Retrieve data:
var product = await cache.GetAsync<Product>("products:1");
Recommended Cache-Aside pattern:
var product = await cache.GetOrAddAsync(
$"products:{id}",
async ct => await repository.GetByIdAsync(id, ct),
expiration: TimeSpan.FromMinutes(10),
tags: ["products"]);
🌐 HTTP Response Caching
Enable the middleware:
app.UseCoreCache();
Decorate your endpoint:
[Cacheable(expirationSeconds:300)]
public async Task<IActionResult> Get(Guid id)
{
return Ok(await service.GetAsync(id));
}
📊 Why CoreSystem.Cache?
Capability IDistributedCache CoreSystem.Cache
Redis ✅ ✅ Memory Provider ❌ ✅ Cache-Aside ❌ ✅ Tag Invalidation ❌ ✅ Automatic Fallback ❌ ✅ Cache Rehydration ❌ ✅ HTTP Response Caching ❌ ✅ OpenTelemetry Metrics ❌ ✅ Health Checks ❌ ✅
🏗 Architecture
Application
│
▼
ICoreCache
│
▼
CachePipeline
│
├── Logging
├── Metrics
├── Fallback
└── Resilience
│
▼
Cache Storage
├── Redis
└── Memory
📚 Documentation
The full documentation includes:
- Getting Started
- Architecture
- Configuration
- Basic Usage
- HTTP Response Caching
- Observability
- Health Checks
- Extensibility
- Roadmap
Visit the GitHub repository for the complete documentation.
🤝 Contributing
Issues, discussions and pull requests are welcome.
📄 License
Released under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- CoreSystem.Memory (>= 1.0.0)
- CoreSystem.Observability.Abstractions (>= 1.0.0)
- CoreSystem.Redis (>= 1.0.0)
- CoreSystem.Serialization (>= 1.2.0)
- MessagePack (>= 3.1.7)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.28)
- Microsoft.Extensions.Options (>= 8.0.2)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Api (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- Polly (>= 8.7.0)
- protobuf-net (>= 3.2.56)
- protobuf-net.Core (>= 3.2.56)
- StackExchange.Redis (>= 2.13.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.