v2.2.0
Additive minor release. No public API breaks. One operational behavior change for Hybrid L2 key naming (see Changed) that cold-starts the Hybrid distributed cache on upgrade.
Added
ClearAsync()(extension method onICacheService) — clears all of this application's cache entries, scoped to the configuredKeyPrefix. Per mode:- InMemory — clears the process memory cache (
MemoryCache.Clear()). - Redis — cursor-based
SCAN {KeyPrefix}:*+ batched delete (neverFLUSHDB; safe on a shared database). - Hybrid — logical invalidation via the reserved wildcard tag
"*"; entries expire naturally. - No-op when caching is disabled or the backend cannot clear. New per-call surface lives on the extension/
IRoutingCacheService, not onICacheService(API-stability contract).
- InMemory — clears the process memory cache (
- Hybrid tag-write wiring:
CacheCallOptions.Tagsis now applied to the underlyingHybridCacheonSetAsyncandGetOrCreateAsync. Previously tags were accepted by the API but dropped before reachingHybridCache, soRemoveByTagAsynchad nothing to match. Tags now function end-to-end in Hybrid mode.
Changed
RemoveManyAsync(Redis) usesUNLINKwhen the server supports it (Redis 4.0+), falling back toDELotherwise.UNLINKreclaims memory on a background thread (non-blocking), improving large-batch deletes. Server support is probed once and cached.- Hybrid L2 per-app isolation:
KeyPrefixis now applied as the Hybrid L2 Redis adapterInstanceNamerather than at the routing layer. This namespaces all Hybrid L2 keys — entries and HybridCache's tag/wildcard invalidation markers — so one app'sClearAsync/RemoveByTagAsyncno longer invalidates another app's entries on a shared Redis database. Requires a uniqueKeyPrefixper application.- Migration / impact: Hybrid L2 physical key names change (markers were previously unprefixed). On upgrade, existing Hybrid L2 entries become unreachable and repopulate on demand (one-time cold cache); orphans expire by TTL. InMemory and Redis modes are unchanged. Hybrid L1 (in-process) keys are now unprefixed (harmless — L1 is per-process); a per-call
Mode = InMemoryoverride in a Hybrid app writes an unprefixed entry.
- Migration / impact: Hybrid L2 physical key names change (markers were previously unprefixed). On upgrade, existing Hybrid L2 entries become unreachable and repopulate on demand (one-time cold cache); orphans expire by TTL. InMemory and Redis modes are unchanged. Hybrid L1 (in-process) keys are now unprefixed (harmless — L1 is per-process); a per-call