RefreshableCacheRegistry is a standalone refreshable cache for secrets or any fetched values, usable in any Python project with no Bakebook required. Subclass FetchFn to declare how a value is fetched, register it under a key, and the first get fetches and caches it:
Refreshing rotated secrets
For secrets rotated while your process runs, wrap the call in@cache.catch_refresh and raise RefreshNeededError when the service rejects the cached value:
call_api retries, re-fetching a fresh token via cache.get(). Retries are tenacity-backed (stop/wait, defaults 2 attempts, no delay), so secrets refresh at runtime with no restart. acatch_refresh is the async variant.
Backends
MemoryCache- default, ephemeralKeyringCache- system keyring, persistentChainedCache- several backends, read-first/write-allNullCache- disabled
ChainedCache. Pass ttl= for expiry.
Secrets wires this registry into a Bakebook with bake secret commands.