Documentation
¶
Index ¶
- Variables
- type Cache
- type MapCache
- type Memory
- func (c *Memory[T]) Close()
- func (c *Memory[T]) Delete(_ context.Context, keys ...string) error
- func (c *Memory[T]) DeleteAll(_ context.Context) error
- func (c *Memory[T]) Exists(_ context.Context, key string) (bool, error)
- func (c *Memory[T]) Get(_ context.Context, key string) (T, error)
- func (c *Memory[T]) GetAll(_ context.Context) ([]T, error)
- func (c *Memory[T]) GetAllMap(_ context.Context) (map[string]T, error)
- func (c *Memory[T]) Set(_ context.Context, key string, value T) error
- func (c *Memory[T]) SetAll(_ context.Context, values []T, keyFunc func(v T) string) error
- func (c *Memory[T]) SetAllMap(_ context.Context, valuesMap map[string]T) error
- func (c *Memory[T]) SetNX(ctx context.Context, key string, value T) (bool, error)
- type Redis
- func (c *Redis[T]) Delete(ctx context.Context, keys ...string) error
- func (c *Redis[T]) Exists(ctx context.Context, key string) (bool, error)
- func (c *Redis[T]) Get(ctx context.Context, key string) (T, error)
- func (c *Redis[T]) Set(ctx context.Context, key string, value T) error
- func (c *Redis[T]) SetNX(ctx context.Context, key string, value T) (bool, error)
- type RedisMap
- func (c *RedisMap[T]) Delete(ctx context.Context, keys ...string) error
- func (c *RedisMap[T]) DeleteAll(ctx context.Context) error
- func (c *RedisMap[T]) Exists(ctx context.Context, key string) (bool, error)
- func (c *RedisMap[T]) Get(ctx context.Context, key string) (T, error)
- func (c *RedisMap[T]) GetAll(ctx context.Context) ([]T, error)
- func (c *RedisMap[T]) GetAllMap(ctx context.Context) (map[string]T, error)
- func (c *RedisMap[T]) Set(ctx context.Context, key string, value T) error
- func (c *RedisMap[T]) SetAll(ctx context.Context, values []T, keyFunc func(v T) string) error
- func (c *RedisMap[T]) SetAllMap(ctx context.Context, valuesMap map[string]T) error
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTTL = time.Hour
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type MapCache ¶
type MapCache[T any] interface { Get(ctx context.Context, key string) (T, error) GetAll(ctx context.Context) ([]T, error) GetAllMap(ctx context.Context) (map[string]T, error) Set(ctx context.Context, key string, value T) error SetAll(ctx context.Context, values []T, keyFunc func(v T) string) error SetAllMap(ctx context.Context, valuesMap map[string]T) error Exists(ctx context.Context, key string) (bool, error) Delete(ctx context.Context, keys ...string) error DeleteAll(ctx context.Context) error }
type Memory ¶
type Memory[T any] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.