Versions in this module Expand all Collapse all v1 v1.1.0 Nov 7, 2026 v1.0.0 Nov 7, 2026 Changes in this version + var ErrMiss = errors.New("cache: miss") + func GetOrSet[T any](ctx context.Context, c Cache, key string, ttl time.Duration, ...) (T, error) + func Get[T any](ctx context.Context, c Cache, key string) (T, bool) + func Key(parts ...string) string + func Set[T any](ctx context.Context, c Cache, key string, value T, ttl time.Duration) + type Cache interface + Delete func(ctx context.Context, keys ...string) error + DeletePrefix func(ctx context.Context, prefix string) error + Get func(ctx context.Context, key string) ([]byte, error) + Ping func(ctx context.Context) error + Set func(ctx context.Context, key string, value []byte, ttl time.Duration) error + type Memory struct + func NewMemory(interval time.Duration) *Memory + func (m *Memory) Close() error + func (m *Memory) Delete(_ context.Context, keys ...string) error + func (m *Memory) DeletePrefix(_ context.Context, prefix string) error + func (m *Memory) Get(_ context.Context, key string) ([]byte, error) + func (m *Memory) Ping(context.Context) error + func (m *Memory) Set(_ context.Context, key string, value []byte, ttl time.Duration) error + type Noop struct + func (Noop) Delete(context.Context, ...string) error + func (Noop) DeletePrefix(context.Context, string) error + func (Noop) Get(context.Context, string) ([]byte, error) + func (Noop) Ping(context.Context) error + func (Noop) Set(context.Context, string, []byte, time.Duration) error + type Redis struct + func NewRedis(client redis.UniversalClient, prefix string) *Redis + func (r *Redis) Close() error + func (r *Redis) Delete(ctx context.Context, keys ...string) error + func (r *Redis) DeletePrefix(ctx context.Context, prefix string) error + func (r *Redis) Get(ctx context.Context, key string) ([]byte, error) + func (r *Redis) Ping(ctx context.Context) error + func (r *Redis) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error