RCommon.Persistence.Caching
2.3.2-alpha.0.2
See the version list below for details.
dotnet add package RCommon.Persistence.Caching --version 2.3.2-alpha.0.2
NuGet\Install-Package RCommon.Persistence.Caching -Version 2.3.2-alpha.0.2
<PackageReference Include="RCommon.Persistence.Caching" Version="2.3.2-alpha.0.2" />
<PackageVersion Include="RCommon.Persistence.Caching" Version="2.3.2-alpha.0.2" />
<PackageReference Include="RCommon.Persistence.Caching" />
paket add RCommon.Persistence.Caching --version 2.3.2-alpha.0.2
#r "nuget: RCommon.Persistence.Caching, 2.3.2-alpha.0.2"
#:package RCommon.Persistence.Caching@2.3.2-alpha.0.2
#addin nuget:?package=RCommon.Persistence.Caching&version=2.3.2-alpha.0.2&prerelease
#tool nuget:?package=RCommon.Persistence.Caching&version=2.3.2-alpha.0.2&prerelease
RCommon.Persistence.Caching
Provides caching decorator repositories that wrap any RCommon persistence provider with a cache layer, enabling cache-aware query overloads on IGraphRepository, ILinqRepository, and ISqlMapperRepository.
Features
CachingGraphRepository<TEntity>-- decorator aroundIGraphRepository<TEntity>that adds cache-awareFindAsyncoverloads accepting a cache keyCachingLinqRepository<TEntity>-- decorator aroundILinqRepository<TEntity>(viaIGraphRepository) with the same cached query patternCachingSqlMapperRepository<TEntity>-- decorator aroundISqlMapperRepository<TEntity>with cachedFindAsyncoverloads- Non-cached operations (Add, Update, Delete, etc.) are delegated directly to the inner repository
PersistenceCachingStrategyenum for strategy-based resolution of theICacheServiceused by repository decoratorsAddPersistenceCaching()extension onIPersistenceBuilderto register all caching repository decorators with a custom cache factory
Installation
dotnet add package RCommon.Persistence.Caching
Usage
using RCommon;
using RCommon.Persistence.Caching;
using RCommon.Persistence.Caching.Crud;
// Register persistence caching with a custom cache factory
services.AddRCommon(builder =>
{
builder.WithPersistence<EfCorePeristenceBuilder>(persistence =>
{
persistence.AddPersistenceCaching(serviceProvider => strategy =>
{
return serviceProvider.GetRequiredService<ICacheService>();
});
});
});
// Use the caching repository in your service
public class ProductService
{
private readonly ICachingGraphRepository<Product> _repo;
public ProductService(ICachingGraphRepository<Product> repo)
{
_repo = repo;
}
public async Task<ICollection<Product>> GetActiveProductsAsync()
{
// Cached query -- checks cache first, falls through to the database on a miss
return await _repo.FindAsync(
CacheKey.With("active-products"),
x => x.IsActive);
}
}
Key Types
| Type | Description |
|---|---|
CachingGraphRepository<TEntity> |
Decorator adding cached FindAsync overloads to IGraphRepository<TEntity> |
CachingLinqRepository<TEntity> |
Decorator adding cached FindAsync overloads to ILinqRepository<TEntity> |
CachingSqlMapperRepository<TEntity> |
Decorator adding cached FindAsync overloads to ISqlMapperRepository<TEntity> |
ICachingGraphRepository<TEntity> |
Interface extending IGraphRepository<TEntity> with cache-key-based query methods |
ICachingLinqRepository<TEntity> |
Interface extending ILinqRepository<TEntity> with cache-key-based query methods |
ICachingSqlMapperRepository<TEntity> |
Interface extending ISqlMapperRepository<TEntity> with cache-key-based query methods |
PersistenceCachingStrategy |
Strategy enum for resolving the ICacheService used by caching repositories |
Documentation
For full documentation, visit rcommon.com.
Related Packages
- RCommon.Caching - Core caching abstractions (
ICacheService,CacheKey) - RCommon.Persistence.Caching.MemoryCache - Wires in-memory caching into persistence caching decorators
- RCommon.Persistence.Caching.RedisCache - Wires Redis caching into persistence caching decorators
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.Caching (>= 2.3.2-alpha.0.2)
- RCommon.Persistence (>= 2.3.2-alpha.0.2)
-
net8.0
- RCommon.Caching (>= 2.3.2-alpha.0.2)
- RCommon.Persistence (>= 2.3.2-alpha.0.2)
-
net9.0
- RCommon.Caching (>= 2.3.2-alpha.0.2)
- RCommon.Persistence (>= 2.3.2-alpha.0.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on RCommon.Persistence.Caching:
| Package | Downloads |
|---|---|
|
RCommon.Persistence.Caching.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.Persistence.Caching.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 | 38 | 2/18/2026 |
| 2.3.2-alpha.0.3 | 31 | 2/18/2026 |
| 2.3.2-alpha.0.2 | 29 | 2/18/2026 |
| 2.3.2-alpha.0.1 | 44 | 2/9/2026 |
| 2.3.1 | 128 | 2/5/2026 |
| 2.3.0 | 116 | 2/3/2026 |
| 2.2.2-alpha.0.1 | 378 | 12/11/2025 |
| 2.2.1-alpha.0.2 | 140 | 10/24/2025 |
| 2.2.1-alpha.0.1 | 134 | 10/24/2025 |
| 2.1.11-alpha.0.2 | 133 | 10/24/2025 |
| 2.1.11-alpha.0.1 | 101 | 7/18/2025 |
| 2.1.10 | 307 | 7/17/2025 |
| 2.1.9-alpha.0.1 | 144 | 7/17/2025 |
| 2.1.2.4 | 235 | 5/21/2025 |
| 2.1.2.3 | 226 | 5/1/2025 |
| 2.1.2.2 | 311 | 1/23/2025 |
| 2.1.2.1 | 180 | 1/17/2025 |
| 2.1.2 | 173 | 1/17/2025 |
| 2.1.1.4 | 178 | 1/7/2025 |
| 0.0.0-alpha.0 | 140 | 7/17/2025 |