RCommon.Caching
2.4.1
dotnet add package RCommon.Caching --version 2.4.1
NuGet\Install-Package RCommon.Caching -Version 2.4.1
<PackageReference Include="RCommon.Caching" Version="2.4.1" />
<PackageVersion Include="RCommon.Caching" Version="2.4.1" />
<PackageReference Include="RCommon.Caching" />
paket add RCommon.Caching --version 2.4.1
#r "nuget: RCommon.Caching, 2.4.1"
#:package RCommon.Caching@2.4.1
#addin nuget:?package=RCommon.Caching&version=2.4.1
#tool nuget:?package=RCommon.Caching&version=2.4.1
RCommon.Caching
Provides the core caching abstractions for RCommon, including the ICacheService interface, strongly-typed cache keys, and builder contracts for plugging in memory or distributed caching providers.
Features
ICacheServiceinterface with genericGetOrCreateandGetOrCreateAsyncmethods (read-through / get-or-create pattern)CacheKeyvalue type with validation, max-length enforcement (256 chars), and factory methods for composite and type-scoped keysIMemoryCachingBuilderandIDistributedCachingBuildercontracts for provider-agnostic DI configurationWithMemoryCaching<T>andWithDistributedCaching<T>extension methods onIRCommonBuilderfor fluent setupExpressionCachingStrategyenum for strategy-based resolution of cache services used to cache dynamically compiled expressions
Installation
dotnet add package RCommon.Caching
Usage
This package is typically consumed indirectly through a concrete provider such as RCommon.MemoryCache or RCommon.RedisCache. You can also program against the abstraction directly:
// Inject ICacheService and use the get-or-create pattern
public class ProductService
{
private readonly ICacheService _cache;
public ProductService(ICacheService cache)
{
_cache = cache;
}
public async Task<Product> GetProductAsync(int id)
{
return await _cache.GetOrCreateAsync(
CacheKey.With("product", id.ToString()),
() => _productRepository.FindAsync(id));
}
}
Key Types
| Type | Description |
|---|---|
ICacheService |
Core abstraction providing GetOrCreate and GetOrCreateAsync for read-through caching |
CacheKey |
Strongly-typed cache key with validation, max-length enforcement, and static factory methods |
IMemoryCachingBuilder |
Builder contract for configuring in-memory caching providers |
IDistributedCachingBuilder |
Builder contract for configuring distributed caching providers |
ExpressionCachingStrategy |
Strategy enum used to resolve the appropriate ICacheService for expression caching |
CachingBuilderExtensions |
WithMemoryCaching<T> and WithDistributedCaching<T> extensions on IRCommonBuilder |
Documentation
For full documentation, visit rcommon.com.
Related Packages
- RCommon.MemoryCache - In-process and distributed memory cache implementations of
ICacheService - RCommon.RedisCache - Redis-backed distributed cache implementation of
ICacheService - RCommon.Persistence.Caching - Caching decorator repositories that layer caching over any persistence provider
License
Licensed under the Apache License, Version 2.0.
| 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 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 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
- RCommon.Core (>= 2.4.1)
-
net8.0
- RCommon.Core (>= 2.4.1)
-
net9.0
- RCommon.Core (>= 2.4.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on RCommon.Caching:
| Package | Downloads |
|---|---|
|
RCommon.ApplicationServices
A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more |
|
|
RCommon.Persistence.Caching
A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more |
|
|
RCommon.MemoryCache
A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more |
|
|
RCommon.RedisCache
A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.4.1 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.3 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.2 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.1 | 53 | 2/9/2026 |
| 2.3.1 | 226 | 2/5/2026 |
| 2.3.0 | 214 | 2/3/2026 |
| 2.2.2-alpha.0.1 | 380 | 12/11/2025 |
| 2.2.1-alpha.0.2 | 128 | 10/24/2025 |
| 2.2.1-alpha.0.1 | 131 | 10/24/2025 |
| 2.1.11-alpha.0.2 | 129 | 10/24/2025 |
| 2.1.11-alpha.0.1 | 102 | 7/18/2025 |
| 2.1.10 | 389 | 7/17/2025 |
| 2.1.9-alpha.0.1 | 139 | 7/17/2025 |
| 2.1.2.4 | 302 | 5/21/2025 |
| 2.1.2.3 | 310 | 5/1/2025 |
| 2.1.2.2 | 624 | 1/23/2025 |
| 2.1.2.1 | 274 | 1/17/2025 |
| 2.1.2 | 261 | 1/17/2025 |
| 2.1.1.4 | 267 | 1/7/2025 |
| 0.0.0-alpha.0 | 150 | 7/17/2025 |