Add ClearCache to Authenticator
Used by Metacrypt when sealing to invalidate cached token validations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,13 @@ func (c *validationCache) get(tokenHash string) (*TokenInfo, bool) {
|
||||
return entry.info, true
|
||||
}
|
||||
|
||||
// clear removes all entries from the cache.
|
||||
func (c *validationCache) clear() {
|
||||
c.mu.Lock()
|
||||
c.entries = make(map[string]cacheEntry)
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
// put stores TokenInfo in the cache with an expiration of now + TTL.
|
||||
func (c *validationCache) put(tokenHash string, info *TokenInfo) {
|
||||
c.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user