Skip to content

Instantly share code, notes, and snippets.

@vincent6767
Created August 26, 2018 08:27
Show Gist options
  • Save vincent6767/09556c0a02b737eab8ef4097b29784dc to your computer and use it in GitHub Desktop.
Save vincent6767/09556c0a02b737eab8ef4097b29784dc to your computer and use it in GitHub Desktop.
Mutex: Cache Invalidation example
import (
“sync"
)
// TokenRevocationRecord represents the token revocation list record
type TokenRevocationRecord struct {}
// TokenRevocationListCache
type TokenRevocationListCache struct {
TokenRevocationList map[string]TokenRevocationRecord
sync.Mutex
}
func (c *TokenRevocationListCache) UpdateCache() error {
c.Lock()
defer c.Unlock()
// update the cache.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment