feat: tag-based invalidation, full Vary/credential eviction, and cache status header (v2.6.0) - #13
Merged
Conversation
… cache status header - IStampedeHttpCache.EvictByTagAsync: responses labeled via CacheOptions.TagHeaderNames (Cache-Tag, Surrogate-Key, xkey conventions; comma- and space-separated) or CacheRequestPolicy.Tags are indexed per tag in the client's own ICacheStore, so one call evicts every tagged entry, Vary variants included. 304 refreshes re-extend the index deadline so long-revalidated entries stay reachable by tag. - EvictAsync now sweeps Vary variants: variant keys are tracked on the primary marker (CacheEntry.TrackedKeys) at store time and removed on explicit eviction, closing the documented unreachable-but-alive trade-off. RFC 9111 4.4 invalidation unchanged. - EvictAsync(uri, authorization): credential-scoped eviction for entries stored under AuthorizationCaching, resolving the same key the authenticated GET stored under. New interface members ship as default interface methods for pre-2.6 implementations. - X-Stampede-Cache response header (StampedeCacheStatus): HIT / MISS / STALE / REVALIDATED on every response the caching layer handles, COALESCED stamped by the coalescer on waiters; never persisted into stored entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the v2.6.0 feature set: complete invalidation plus observability.
Tag-based invalidation (
EvictByTagAsync)CacheOptions.TagHeaderNames(Cache-Tag,Surrogate-Key,xkey— comma- and space-separated values both parse) or attached per request viaCacheRequestPolicy.Tags.ICacheStore(memory or distributed), listing the primary keys carrying it;EvictByTagAsync("products")sweeps them all, Vary variants included, then drops the index.CacheEntry.Tags) so every 304 refresh re-extends the index deadline — a repeatedly revalidated entry can't outlive its index.Explicit eviction sweeps Vary variants
CacheEntry.TrackedKeys) as they are stored;EvictAsyncfollows the marker and removes them, closing the documented unreachable-but-alive trade-off.Credential-scoped eviction
EvictAsync(uri, authorization)resolves the credential-scoped key authenticated GETs store under withAuthorizationCachingenabled, closing the 2.4 limitation. NewIStampedeHttpCachemembers ship as default interface methods (throwingNotSupportedException) so pre-2.6 custom implementations keep compiling.Cache status header (
X-Stampede-Cache)HIT/MISS/STALE/REVALIDATED; the coalescer stampsCOALESCEDon waiters that shared another caller's in-flight origin call (survives the caching layer's miss marking).StampedeCacheStatus; stored entries strip the header, so a replayed hit always reports its own status.Compatibility
CacheEntrygainsTrackedKeysandTags(both default[]; pre-2.6 serialized entries deserialize cleanly — covered by tests).Tests
-warnaserror.🤖 Generated with Claude Code