Bsft.Caching.Data 2.2.0

dotnet add package Bsft.Caching.Data --version 2.2.0
                    
NuGet\Install-Package Bsft.Caching.Data -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.Data" 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.Data" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Bsft.Caching.Data" />
                    
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.Data --version 2.2.0
                    
#r "nuget: Bsft.Caching.Data, 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.Data@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.Data&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Bsft.Caching.Data&version=2.2.0
                    
Install as a Cake Tool

Bsft.Caching.Data

Folds the current tenant into every cache key, so a cacheable query answered for one tenant is never served to another, and bypasses the cache entirely while no tenant is resolved. It is the caching family's bridge to Bsft.Data's multi-tenancy.

Install

dotnet add package Bsft.Caching.Data

Requires Bsft.Caching for the key builder that reads the scope and Bsft.Data for the tenant context (both pulled transitively). It is a separate package so that neither family depends on the other: a single-tenant host caches without the data layer, and a multi-tenant host that caches nothing takes no cache.

Register

services.AddBsftDataMultiTenancy(configuration, tenancy => tenancy.ResolveFromClaim());
services.AddBsftCaching(configuration);
services.AddBsftCachingMediator();

services.AddBsftCachingData();   // tenant-scoped cache keys

Nothing else is required, and the order of the calls does not matter: the tenant-blind default GlobalCacheKeyScopeProvider is removed rather than merely tried past. Leaving the call out of a multi-tenant host is reported as a startup warning by Bsft.Data.

Configure

Option Default Effect
CachingDataDefaults.TenantScopePrefix tenant: The prefix a resolved tenant's scope carries, followed by the tenant identifier.

Validation: none — the package has nothing a deployment states.

While no tenant is resolved

The provider then reports CacheKeyScope.NotCacheable, and CachingBehavior runs the request through its handler without reading or writing the cache. It does not fall back to a substitute scope: every request that failed to resolve would share it, and one of them may still produce a tenant-specific result — a host authenticating through another mechanism, a header dropped in front of the app, a caller omitting it on purpose — which the next unresolved request would then be served. The cost is the missed hit for such requests; nothing is written, so there is no shared bucket and no garbage in the store. Within one request the tenant may still arrive late: caching starts from the call that sees it.

Extend

ICacheKeyScopeProvider (what every cache key is qualified with; this package supplies the tenant). A host that also caches per user registers its own provider folding both in: this package adds with TryAdd, so a provider registered before it wins. A provider of your own returns CacheKeyScope.NotCacheable for the same reason whenever its context did not resolve.

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 57 10/23/2026
2.1.0 112 9/28/2026