Documentation
¶
Overview ¶
Package redis is a cache.Store in Redis, or anything that speaks its protocol (Valkey, KeyDB, Dragonfly), shared by every process of the app. It speaks RESP itself, with the four commands the cache needs, so it adds no dependency.
store, err := redis.New(os.Getenv("REDIS_URL")) // redis://:password@host:6379/0
c := cache.New(store)
Index ¶
- type Error
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, keys ...string) error
- func (s *Store) Get(ctx context.Context, key string) ([]byte, bool, error)
- func (s *Store) Incr(ctx context.Context, key string) (int64, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a cache.Store in Redis.
func New ¶
New connects to the server at rawURL, redis://[user:password@]host:port[/db] or rediss:// for TLS. Connections are made as needed, up to 16 idle.
Click to show internal directories.
Click to hide internal directories.