Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTTL = 1 * time.Hour
Functions ¶
Types ¶
type CacheConfigFunc ¶
type CacheConfigFunc func(*config)
func AsyncSetter ¶
func AsyncSetter(value bool) CacheConfigFunc
func OnError ¶
func OnError(fn func(err error)) CacheConfigFunc
func TTL ¶
func TTL(duration time.Duration) CacheConfigFunc
type Claimer ¶ added in v0.11.0
Claimer is an optional capability for caches that can perform atomic set-if-absent. Backends that cannot provide this guarantee should not implement it.
Add inserts key→value only if the key is absent or expired. It returns true if this caller won the claim, false if another caller already holds an unexpired entry. Use this for deduplication or leader-election where a Get-then-Set sequence would race.
Click to show internal directories.
Click to hide internal directories.