Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVMap ¶
type KVMap[K comparable, V any] struct { // contains filtered or unexported fields }
KVMap represents map with arbitrary key and value types
type RedisClient ¶
type RedisClient interface {
GetStruct(ctx context.Context, key string, value any) error
SetStruct(ctx context.Context, key string, value any, ttl time.Duration) error
DeleteByMatch(ctx context.Context, pattern string) error
Delete(ctx context.Context, key string) error
}
RedisClient provides methods for working with redis
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore represents redis store
func NewRedisStore ¶
func NewRedisStore(redisClient RedisClient, log *zap.Logger) *RedisStore
NewRedisStore creates new Cache instance
func (*RedisStore) Delete ¶ added in v1.2.0
func (rs *RedisStore) Delete(ctx context.Context, key string) error
Delete removes data by key from cache
func (*RedisStore) DeleteByStartsWith ¶ added in v1.2.0
func (rs *RedisStore) DeleteByStartsWith(ctx context.Context, key string) error
DeleteByStartsWith removes data with key starting with provided key from cache
func (*RedisStore) Get ¶ added in v1.2.0
func (rs *RedisStore) Get[T any](ctx context.Context, key string, val *T, fn func() (T, error), ttl time.Duration) error
Get gets value by key from cache. If key not present, runs fn and stores result in cache and returns result. If ttl == 0, default ttl is used.
Click to show internal directories.
Click to hide internal directories.