Documentation
¶
Overview ¶
Package rediscache is a Redis-backed cache that satisfies cache.Cache. Opt-in: importing this package pulls in github.com/redis/go-redis/v9; the root cache package has no driver dependency.
Uses SET key value PX millis for writes (atomic with TTL) and GET for reads. TTL is enforced by Redis itself, so there's no separate reaper to run — expired keys disappear automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a Redis-backed implementation of cache.Cache. Pass any implementation of redis.UniversalClient — standalone, sentinel, or cluster — so consumers control connection / reconnect handling.
func WithPrefix ¶
func WithPrefix(client redis.UniversalClient, prefix string) *Cache
WithPrefix prepends prefix + ":" to every key. Useful to keep multiple SDK consumers from colliding on a shared Redis instance.