TailoredApps.Shared.MediatR.Caching
2.1.0
See the version list below for details.
dotnet add package TailoredApps.Shared.MediatR.Caching --version 2.1.0
NuGet\Install-Package TailoredApps.Shared.MediatR.Caching -Version 2.1.0
<PackageReference Include="TailoredApps.Shared.MediatR.Caching" Version="2.1.0" />
<PackageVersion Include="TailoredApps.Shared.MediatR.Caching" Version="2.1.0" />
<PackageReference Include="TailoredApps.Shared.MediatR.Caching" />
paket add TailoredApps.Shared.MediatR.Caching --version 2.1.0
#r "nuget: TailoredApps.Shared.MediatR.Caching, 2.1.0"
#:package TailoredApps.Shared.MediatR.Caching@2.1.0
#addin nuget:?package=TailoredApps.Shared.MediatR.Caching&version=2.1.0
#tool nuget:?package=TailoredApps.Shared.MediatR.Caching&version=2.1.0
TailoredApps.Shared.MediatR.Caching
A contracts-only package with one interface, ICachableRequest<TResponse>: a MediatR request that names its
own cache key. It lets a request type say how its response is identified in a cache without referencing any
caching implementation.
Installation
dotnet add package TailoredApps.Shared.MediatR.Caching
Registration
Nothing to register: the package has no dependency-injection extension and no services.
Usage
using TailoredApps.Shared.MediatR.Caching;
public class GetUserProfile : ICachableRequest<UserProfileDto>
{
public int UserId { get; init; }
public string Language { get; init; } = "en";
public string GetCacheKey() => $"user-profile:{UserId}:{Language}";
}
ICachableRequest<TResponse> extends IRequest<TResponse>, so the request is sent and handled like any other
MediatR request.
Good to know
The interface is a marker with a key; nothing in this package stores or reads a cache.
CachingBehaviorinTailoredApps.Shared.MediatRdoes not look atICachableRequest<TResponse>. It caches a request only when anICachePolicy<TRequest, TResponse>is registered for it. To cache the request above with that behaviour, add a policy that returns the request's own key:using TailoredApps.Shared.MediatR.Interfaces.Caching; public class GetUserProfileCachePolicy : ICachePolicy<GetUserProfile, UserProfileDto> { public string GetCacheKey(GetUserProfile request) => request.GetCacheKey(); }The key is all that identifies a cached response. Put every value that changes the response into it, including the user or tenant when the data is per user.
Documentation
https://shared.tailoredapps.pl/en/Libraries/MediatR/Caching/
| 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. net11.0 is compatible. |
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TailoredApps.Shared.MediatR.Caching:
| Package | Downloads |
|---|---|
|
TailoredApps.Shared.MediatR
Shared.MediatR is a popular high-performance MediatR framework for .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview.2 | 47 | 11/12/2026 |
| 3.0.0-preview.1 | 51 | 11/12/2026 |
| 2.1.0 | 63 | 11/12/2026 |
| 2.0.1 | 61 | 11/12/2026 |
| 2.0.0 | 67 | 11/12/2026 |
| 1.6.0 | 61 | 11/12/2026 |
| 1.4.19 | 501 | 10/26/2026 |
| 1.4.18 | 725 | 10/23/2026 |
| 1.4.17 | 1,054 | 10/6/2026 |
| 1.4.16 | 145 | 9/28/2026 |
| 1.4.15 | 163 | 9/21/2026 |
| 1.4.14 | 179 | 8/20/2026 |
| 1.4.13 | 170 | 8/20/2026 |
| 1.4.12 | 191 | 8/20/2026 |
| 1.4.11 | 179 | 8/7/2026 |
| 1.4.10 | 309 | 7/8/2026 |
| 1.4.9 | 203 | 7/8/2026 |
| 1.4.8 | 214 | 7/6/2026 |
| 1.4.7 | 301 | 5/20/2026 |
| 1.4.6 | 197 | 5/20/2026 |