Documentation
¶
Index ¶
- Constants
- type Cache
- func (c *Cache) ComputeIfAbsent(key string, f func() (any, bool)) (any, bool)
- func (c *Cache) Get(key string) (any, bool)
- func (c *Cache) GetOrSet(key string, f func() any) any
- func (c *Cache) Init(context *core.Context) error
- func (c *Cache) Invalidate(key string) (any, bool)
- func (c *Cache) Set(key string, value any)
- func (c *Cache) SetIfAbsent(key string, value any) (any, bool)
- func (c *Cache) SetNX(key string, value any, expire time.Duration) (any, bool)
- func (c *Cache) Stats() stats.Stats
- type Config
Constants ¶
View Source
const ConfigKey = "cache"
ConfigKey is the configuration key under which cache settings are stored.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides a high-performance in-memory cache backed by Otter.
func (*Cache) ComputeIfAbsent ¶
ComputeIfAbsent atomically computes a value if the key is not present. f should return (value, cancel); if cancel is true the operation is aborted.
func (*Cache) Invalidate ¶
Invalidate removes a key from the cache.
func (*Cache) SetIfAbsent ¶
SetIfAbsent stores a value only if the key does not already exist.
Click to show internal directories.
Click to hide internal directories.