Documentation
¶
Index ¶
- Constants
- func NewBackend(cfg *Config, opts ...cachestore.StoreOptions) (cachestore.Backend, error)
- type Config
- type RedisStore
- func (c *RedisStore[V]) BatchGet(ctx context.Context, keys []string) ([]V, []bool, error)
- func (c *RedisStore[V]) BatchSet(ctx context.Context, keys []string, values []V) error
- func (c *RedisStore[V]) BatchSetEx(ctx context.Context, keys []string, values []V, ttl time.Duration) error
- func (c *RedisStore[V]) ByteStore() cachestore.Store[[]byte]
- func (c *RedisStore[V]) ClearAll(ctx context.Context) error
- func (c *RedisStore[V]) Delete(ctx context.Context, key string) error
- func (c *RedisStore[V]) DeletePrefix(ctx context.Context, keyPrefix string) error
- func (c *RedisStore[V]) Exists(ctx context.Context, key string) (bool, error)
- func (c *RedisStore[V]) Get(ctx context.Context, key string) (V, bool, error)
- func (c *RedisStore[V]) GetOrSetWithLock(ctx context.Context, key string, ...) (V, error)
- func (c *RedisStore[V]) GetOrSetWithLockEx(ctx context.Context, key string, ...) (V, error)
- func (c *RedisStore[V]) Name() string
- func (c *RedisStore[V]) Options() cachestore.StoreOptions
- func (c *RedisStore[V]) RedisClient() *redis.Client
- func (c *RedisStore[V]) Set(ctx context.Context, key string, value V) error
- func (c *RedisStore[V]) SetEx(ctx context.Context, key string, value V, ttl time.Duration) error
Constants ¶
View Source
const DefaultTTL = time.Second * 24 * 60 * 60 // 1 day in seconds
Variables ¶
This section is empty.
Functions ¶
func NewBackend ¶
func NewBackend(cfg *Config, opts ...cachestore.StoreOptions) (cachestore.Backend, error)
Types ¶
type Config ¶
type Config struct { cachestore.StoreOptions Enabled bool `toml:"enabled"` Host string `toml:"host"` Port uint16 `toml:"port"` DBIndex int `toml:"db_index"` // default 0 MaxIdle int `toml:"max_idle"` // default 4 MaxActive int `toml:"max_active"` // default 8 KeyTTL time.Duration `toml:"key_ttl"` // default 1 day }
type RedisStore ¶
type RedisStore[V any] struct { // contains filtered or unexported fields }
func NewCache ¶
func NewCache[V any](cfg *Config, opts ...cachestore.StoreOptions) (*RedisStore[V], error)
func (*RedisStore[V]) BatchSet ¶
func (c *RedisStore[V]) BatchSet(ctx context.Context, keys []string, values []V) error
func (*RedisStore[V]) BatchSetEx ¶
func (*RedisStore[V]) ByteStore ¶
func (c *RedisStore[V]) ByteStore() cachestore.Store[[]byte]
func (*RedisStore[V]) Delete ¶
func (c *RedisStore[V]) Delete(ctx context.Context, key string) error
func (*RedisStore[V]) DeletePrefix ¶
func (c *RedisStore[V]) DeletePrefix(ctx context.Context, keyPrefix string) error
func (*RedisStore[V]) GetOrSetWithLock ¶
func (*RedisStore[V]) GetOrSetWithLockEx ¶
func (*RedisStore[V]) Name ¶
func (c *RedisStore[V]) Name() string
func (*RedisStore[V]) Options ¶
func (c *RedisStore[V]) Options() cachestore.StoreOptions
func (*RedisStore[V]) RedisClient ¶
func (c *RedisStore[V]) RedisClient() *redis.Client
Click to show internal directories.
Click to hide internal directories.