TailoredApps.Shared.MediatR.Caching 2.1.0

There is a newer prerelease version of this package available.
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
                    
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="TailoredApps.Shared.MediatR.Caching" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailoredApps.Shared.MediatR.Caching" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TailoredApps.Shared.MediatR.Caching" />
                    
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 TailoredApps.Shared.MediatR.Caching --version 2.1.0
                    
#r "nuget: TailoredApps.Shared.MediatR.Caching, 2.1.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 TailoredApps.Shared.MediatR.Caching@2.1.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=TailoredApps.Shared.MediatR.Caching&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TailoredApps.Shared.MediatR.Caching&version=2.1.0
                    
Install as a Cake Tool

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.

  • CachingBehavior in TailoredApps.Shared.MediatR does not look at ICachableRequest<TResponse>. It caches a request only when an ICachePolicy<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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed