Bsft.Caching.Mediator 2.2.0

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

Bsft.Caching.Mediator

The behavior package of the Bsft.Caching family: a mediator pipeline behavior that serves cacheable queries from the configured cache store and writes the handler's result back on a miss.

Install

dotnet add package Bsft.Caching.Mediator

Requires Bsft.Caching and Bsft.Mediator.Abstractions (both pulled transitively). It exists as its own package so that a host caching by hand — through ICacheStore and ICacheInvalidator — takes no mediator dependency at all.

Register

services.AddBsftCaching();
services.AddBsftCachingMediator();

Then mark the queries whose results may be cached:

public sealed record GetProductQuery(Guid Id) : IQuery<Product>, ICacheable
{
    public string CacheKey => Id.ToString();
}

Nothing else is required. Call this after AddBsftMediator and after every authorization behavior: the mediator runs behaviors in registration order, innermost last, so a behavior registered after this one no longer runs on a cache hit. Calling it twice registers a single behavior.

Configure

Option Default Effect
— — The package has no options type. Lifetime and key prefix come from BsftCachingOptions (section Bsft:Caching) in Bsft.Caching, and per-request lifetime and tags come from ICacheable.

Validation: none here — Bsft.Caching validates the options both packages read.

Extend

None of its own. What the behavior does is decided by the seams of Bsft.Caching: ICacheStore (where entries live), ICacheKeyBuilder and ICacheKeyScopeProvider (how a key is composed and scoped) and ICacheTagIndex (which keys a tag reaches). Replace them there.

A command carrying ICacheable is never served from the cache, a null result and a non-positive lifetime are not written, and a store or tag index that cannot be reached degrades the request to an uncached one rather than failing it.

Documentation

Topic page: docs/caching.md. Conventions: docs/package-conventions.md.

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 82 10/23/2026
2.1.0 103 9/28/2026