feat(secret): add Cache.Invalidate to drop a cached secret on rotation#97
Merged
Conversation
secret.Cache had no way to evict an entry, so a caller that rotates or deletes a secret through the underlying manager would keep reading the stale cached value for the rest of the TTL. Invalidate(name) drops the current-version entry, forcing the next unversioned GetSecretValue to re-fetch. Version-pinned entries are left intact since a specific version is immutable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018SrxyoWmvc3fjrbdWrHogq
achille-roussel
approved these changes
Jun 25, 2026
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.
secret.CachecachesGetSecretValueresults under a TTL but exposes no way to evict an entry. A caller that rotates or deletes a secret through the underlying manager keeps reading the stale cached value until the TTL elapses — there's no way to force a re-read.This adds
Invalidate(name):Behavior
cacheKey{name}), which is the one that can go stale after a rotation/delete.cache.TTL.Drop; no new state.