Documentation
¶
Overview ¶
Package redis provides a Redis implementation of cache.Cache.
Values are stored gob-encoded. When the cache is parameterised with V=any, decoding goes through *interface{} and gob requires the concrete value type to be pre-registered:
gob.Register(MyStruct{})
Without registration, Get returns "gob: type not registered for interface". Caches parameterised with a concrete V (e.g. Cache[string, MyStruct]) round-trip directly and need no registration.
Index ¶
- Variables
- type Cache
- func (c *Cache[K, V]) Add(key K, value V, duration time.Duration) (bool, error)
- func (c *Cache[K, V]) Get(key K) (V, error)
- func (c *Cache[K, V]) Keys(prefix K) []K
- func (c *Cache[K, V]) Pop(key K) (V, error)
- func (c *Cache[K, V]) Remove(keys ...K) error
- func (c *Cache[K, V]) Set(key K, value V, duration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOperationTimeout = 10 * time.Second
View Source
var ErrNotFound = cache.ErrNotFound
ErrNotFound aliases cache.ErrNotFound for callers using redis.ErrNotFound.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.