CoreSystem.Cache 2.0.0

dotnet add package CoreSystem.Cache --version 2.0.0
                    
NuGet\Install-Package CoreSystem.Cache -Version 2.0.0
                    
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="CoreSystem.Cache" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreSystem.Cache" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CoreSystem.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 CoreSystem.Cache --version 2.0.0
                    
#r "nuget: CoreSystem.Cache, 2.0.0"
                    
#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 CoreSystem.Cache@2.0.0
                    
#: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=CoreSystem.Cache&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CoreSystem.Cache&version=2.0.0
                    
Install as a Cake Tool

⚡ CoreSystem.Cache

Production-ready distributed caching framework for .NET 8

CoreSystem.Cache provides a unified cache abstraction with an execution pipeline, Memory caching, optional external cache storage with fallback, HTTP response caching, OpenTelemetry metrics, and tag-based invalidation.

NuGet Downloads License .NET


✨ Features

  • ✅ Memory cache provider
  • ✅ Cache-Aside (GetOrAddAsync)
  • ✅ Tag-based invalidation
  • ✅ Optional external cache with Memory fallback
  • ✅ HTTP response caching
  • ✅ OpenTelemetry metrics for cache hits and misses
  • ✅ Configurable execution pipeline
  • ✅ Optional resilience integration through Core.Resilience
  • ✅ Configurable serialization through Core.Serialization

Redis support is provided by the CoreSystem.Cache.Redis package, which registers Redis as the external primary storage and uses Memory as the fallback storage.


📦 Installation

dotnet add package CoreSystem.Cache

For Redis support, add the Redis provider package separately:

dotnet add package CoreSystem.Cache.Redis

🚀 Quick Start

Register the framework:

builder.Services.AddCoreCache(options =>
{
    options.DefaultExpiration = TimeSpan.FromMinutes(30);
});

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));
}

HTTP response caching is applied only to endpoints decorated with CacheableAttribute. The default request policy allows GET and HEAD requests and excludes requests containing an Authorization header.


📊 Why CoreSystem.Cache?

Capability IDistributedCache CoreSystem.Cache
Memory Provider
Cache-Aside
Tag Invalidation
Primary + Fallback Storage
HTTP Response Caching
OpenTelemetry Metrics
Configurable Cache Pipeline

Redis and resilience capabilities are provided through their corresponding CoreSystem packages and are integrated with the cache pipeline when registered and configured.


🏗 Architecture

Application
      │
      ▼
 ICoreCache
      │
      ▼
 CachePipeline
      │
      ├── Logging
      ├── Metrics
      ├── Fallback (when available)
      └── Resilience (when registered)
      │
      ▼
 Cache Storage Resolver
      │
      ├── External Storage (Primary)
      │
      └── Memory Storage (Fallback)

When no external cache storage is registered, Memory is used as the primary storage. When one external storage is registered, it becomes the primary storage and Memory becomes the fallback. The core resolver allows only one external cache storage to be registered.


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

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CoreSystem.Cache:

Package Downloads
CoreSystem.Cache.Rehydration

Cache recovery component for CoreSystem.Cache on .NET 8 that restores tracked memory fallback entries to the primary cache provider after recovery.

CoreSystem.Cache.Redis

Redis external cache provider for CoreSystem.Cache on .NET 8, with tag-based invalidation, distributed locking, health checks, and optional resilience integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 119 8/16/2026
1.2.0 144 8/5/2026
1.1.0 147 7/12/2026
1.0.1 122 7/6/2026
1.0.0 121 7/5/2026