Versions in this module Expand all Collapse all v1 v1.1.0 Apr 20, 2024 Changes in this version + var ErrNotSupported = errors.New("cache: not supported") type Manager + func NewLRU(capability int, onEvict func(key string, val []byte), expire time.Duration) Manager + func NewRedis(client *redis.Client) Manager v1.0.0 Apr 9, 2024 Changes in this version + var ErrInActive = errors.New("cache: inactive") + var ErrNotFound = errors.New("cache: key not found") + type Config struct + EnableMetrics bool + EnableTraffic bool + type ConfigOption func(*Config) + func WithEnableMetrics(enable bool) ConfigOption + func WithEnableTraffic(enable bool) ConfigOption + type Interceptor interface + Apply func(client *redis.Client) + func NewInterceptor(config Config) Interceptor + func NewInterceptorWithOpts(opts ...ConfigOption) Interceptor + type Manager interface + Del func(ctx context.Context, key string) (err error) + Eval func(ctx context.Context, script string, keys []string, args ...any) (val any, err error) + Expire func(ctx context.Context, key string, expire time.Duration) (err error) + Get func(ctx context.Context, key string) (raw string, err error) + GetBlob func(ctx context.Context, key string, output any) (err error) + Set func(ctx context.Context, key string, raw string, expire time.Duration) (err error) + SetBlob func(ctx context.Context, key string, val any, expire time.Duration) (err error) + SetNx func(ctx context.Context, key string, raw string, expire time.Duration) (existing bool, err error) + func NewLocal() Manager + func NewManager(client *redis.Client, opts Options) Manager + type MockManager struct + func NewMockManager(t interface{ ... }) *MockManager + func (_m *MockManager) Del(ctx context.Context, key string) error + func (_m *MockManager) Eval(ctx context.Context, script string, keys []string, args ...interface{}) (interface{}, error) + func (_m *MockManager) Expire(ctx context.Context, key string, expire time.Duration) error + func (_m *MockManager) Get(ctx context.Context, key string) (string, error) + func (_m *MockManager) GetBlob(ctx context.Context, key string, output interface{}) error + func (_m *MockManager) Set(ctx context.Context, key string, raw string, expire time.Duration) error + func (_m *MockManager) SetBlob(ctx context.Context, key string, val interface{}, expire time.Duration) error + func (_m *MockManager) SetNx(ctx context.Context, key string, raw string, expire time.Duration) (bool, error) + type Opt func(m *manager) + type Options []Opt