Innovabit.DotNet.Interceptors.Caching.Abstractions
2.0.113
See the version list below for details.
dotnet add package Innovabit.DotNet.Interceptors.Caching.Abstractions --version 2.0.113
NuGet\Install-Package Innovabit.DotNet.Interceptors.Caching.Abstractions -Version 2.0.113
<PackageReference Include="Innovabit.DotNet.Interceptors.Caching.Abstractions" Version="2.0.113" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Caching.Abstractions" Version="2.0.113" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Caching.Abstractions" />
paket add Innovabit.DotNet.Interceptors.Caching.Abstractions --version 2.0.113
#r "nuget: Innovabit.DotNet.Interceptors.Caching.Abstractions, 2.0.113"
#:package Innovabit.DotNet.Interceptors.Caching.Abstractions@2.0.113
#addin nuget:?package=Innovabit.DotNet.Interceptors.Caching.Abstractions&version=2.0.113
#tool nuget:?package=Innovabit.DotNet.Interceptors.Caching.Abstractions&version=2.0.113
Innovabit.DotNet.Interceptors.Caching.Abstractions
Method-result caching for Innovabit.DotNet.Interceptors
via a [Cache] attribute. This is the provider-agnostic base: it ships the interceptor, the
attribute, the pluggable key generator/serializer and the ICacheStore abstraction. Pick a store
provider to actually cache anything:
Innovabit.DotNet.Interceptors.Caching.Memory— in-process cache on .NET'sIMemoryCache.Innovabit.DotNet.Interceptors.Caching.Redis— distributed cache on Redis (IDistributedCache).
Usage
services
.AddInterceptors()
.AddInMemoryCache() // or .AddRedisCache(o => o.Configuration = "localhost:6379")
.ConfigureCacheDefaults(d => d.DurationSeconds = 60); // optional global defaults
services.AddScopedWithInterception<IPriceService, PriceService>();
public class PriceService : IPriceService
{
// Cached for 30s; a bare [Cache] would inherit the configured defaults.
[Cache(DurationSeconds = 30)]
public Task<decimal> GetQuoteAsync(string symbol) => _api.FetchAsync(symbol);
}
The first call runs the method and stores the result; later calls with the same arguments return
the cached value without invoking the method. Only value-returning methods are cached — void,
Task and ValueTask (no result) are ignored; Task<T>/ValueTask<T> are cached on their
unwrapped result.
[Cache] / CacheDefaults
| Property | Meaning |
|---|---|
DurationSeconds |
Absolute lifetime in seconds. 0 = no absolute expiration. |
SlidingExpirationSeconds |
Expire after this long without a read. 0 = disabled. |
KeyPrefix |
Prefix prepended to the generated key (namespacing per tenant/version/…). |
CacheNullValues |
Whether a null result is cached. Defaults to false. |
Any property left unset on [Cache] inherits from the CacheDefaults configured via
ConfigureCacheDefaults; a property set on the method always wins.
Cache keys
The key is derived per method + argument values, so calls with different arguments are cached
separately and calls with the same arguments share an entry. The default ICacheKeyGenerator hashes
the method signature and the JSON-serialized arguments (SHA-256).
Two kinds of parameter are left out of the key:
CancellationTokenparameters — always ignored (runtime plumbing, not part of a call's identity).- Parameters marked
[CacheKeyIgnore]— opt a specific parameter out of the key when it does not affect the result (a logger, a correlation id, anIProgress<T>callback, …).
// requestId does not change the result, so both calls hit the same cache entry:
[Cache(DurationSeconds = 30)]
public Task<Quote> GetQuoteAsync(string symbol, [CacheKeyIgnore] Guid requestId) => _api.FetchAsync(symbol);
[CacheKeyIgnore] is honoured by the default key generator; a custom generator defines its own
policy. Like other parameter-level attributes it only has an effect while the method is intercepted
(also carries [Cache]) — the bundled analyzer warns (INTX002) when it does not.
Flexibility / extension points
Everything is resolved from DI and can be swapped:
ICacheStore— the backing store. Provided by the Memory/Redis packages; implement your own for any backend.ICacheKeyGenerator— how keys are derived. Default: SHA-256 over the method signature + JSON-serialized arguments (ignoringCancellationTokenand[CacheKeyIgnore]parameters). Replace withUseCacheKeyGenerator<T>().ICacheSerializer— how values are serialized for distributed stores. Default:System.Text.Json. Replace withUseCacheSerializer<T>().
Pipeline order
CacheInterceptor runs at InterceptorOrders.Caching (200) — above retry/timeout so a hit
short-circuits the expensive work, below validation so invalid arguments still fail fast. Override
per registration with .Register<CacheInterceptor>(order) / .SetOrder<CacheInterceptor>(order).
| 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
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.113)
-
net8.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.113)
- System.Text.Json (>= 10.0.12)
-
net9.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.113)
- System.Text.Json (>= 10.0.12)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Innovabit.DotNet.Interceptors.Caching.Abstractions:
| Package | Downloads |
|---|---|
|
Innovabit.DotNet.Interceptors.Caching.Memory
In-memory (IMemoryCache) store provider for interceptor-based caching. |
|
|
Innovabit.DotNet.Interceptors.Caching.Redis
Redis (IDistributedCache) store provider for interceptor-based caching. |
|
|
Innovabit.DotNet.Interceptors.All
Meta-package: every interceptor concern in the suite (logging, validation, caching, notifications, telemetry, audit, authorization, rate limiting, coordination, feature gates, transactions, retry/timeout/circuit breaker/fallback) in one reference. Providers are separate packages — pick the ones you use. |
|
|
Innovabit.DotNet.Interceptors.Caching.Hybrid
HybridCache (L1 + L2, with stampede protection) store provider for interceptor-based caching. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.119 | 57 | 11/14/2026 |
| 2.0.118 | 173 | 11/7/2026 |
| 2.0.117 | 185 | 10/31/2026 |
| 2.0.116 | 169 | 10/26/2026 |
| 2.0.115 | 180 | 10/17/2026 |
| 2.0.114 | 177 | 10/10/2026 |
| 2.0.113 | 180 | 10/3/2026 |
| 2.0.112 | 171 | 9/28/2026 |
| 2.0.111 | 157 | 9/28/2026 |
| 2.0.110 | 167 | 9/27/2026 |
| 2.0.109 | 166 | 9/26/2026 |
| 2.0.108 | 160 | 9/26/2026 |
| 2.0.107 | 220 | 9/26/2026 |
| 2.0.105 | 173 | 9/25/2026 |
| 1.0.0.104 | 159 | 9/25/2026 |
| 1.0.0.103 | 124 | 9/25/2026 |
| 1.0.0.102 | 130 | 9/25/2026 |
| 1.0.0.101 | 136 | 9/25/2026 |
| 1.0.0.100 | 137 | 9/25/2026 |
| 1.0.0.99 | 135 | 9/25/2026 |