Documentation
¶
Index ¶
- type Memory
- func (m *Memory) Decrement(ctx context.Context, key string, by int64) (int64, error)
- func (m *Memory) Delete(_ context.Context, key string) error
- func (m *Memory) Forever(_ context.Context, key string, value any) error
- func (m *Memory) Get(_ context.Context, key string) (any, error)
- func (m *Memory) Has(_ context.Context, key string) (bool, error)
- func (m *Memory) Increment(ctx context.Context, key string, by int64) (int64, error)
- func (m *Memory) Pull(ctx context.Context, key string) (any, error)
- func (m *Memory) Put(_ context.Context, key string, value any, ttl time.Duration) error
- func (m *Memory) Remember(ctx context.Context, key string, ttl time.Duration, ...) (any, error)
- func (m *Memory) RememberForever(ctx context.Context, key string, compute func() (any, error)) (any, error)
- type RedisClient
- func (c *RedisClient) Decrement(ctx context.Context, key string, by int64) (int64, error)
- func (c *RedisClient) Delete(ctx context.Context, key string) error
- func (c *RedisClient) Forever(ctx context.Context, key string, value any) error
- func (c *RedisClient) Get(ctx context.Context, key string) (any, error)
- func (c *RedisClient) Has(ctx context.Context, key string) (bool, error)
- func (c *RedisClient) Increment(ctx context.Context, key string, by int64) (int64, error)
- func (c *RedisClient) Pull(ctx context.Context, key string) (v any, e error)
- func (c *RedisClient) Put(ctx context.Context, key string, value any, ttl time.Duration) error
- func (c *RedisClient) Remember(ctx context.Context, key string, ttl time.Duration, ...) (any, error)
- func (c *RedisClient) RememberForever(ctx context.Context, key string, compute func() (any, error)) (any, error)
- type RedisOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) Decrement ¶
Decrement atomically decreases the integer value stored at key by the given amount.
func (*Memory) Increment ¶
Increment atomically increases the integer value stored at key by the given amount.
type RedisClient ¶
func NewRedis ¶
func NewRedis(options *RedisOptions) *RedisClient
func NewRedisFrom ¶ added in v0.9.0
func NewRedisFrom(client *redis.Client) *RedisClient
func (*RedisClient) Delete ¶
func (c *RedisClient) Delete(ctx context.Context, key string) error
Delete removes a key.
func (*RedisClient) Remember ¶
func (c *RedisClient) Remember(ctx context.Context, key string, ttl time.Duration, compute func() (any, error)) (any, error)
Remember gets or computes and caches a value with TTL.
func (*RedisClient) RememberForever ¶
func (c *RedisClient) RememberForever(ctx context.Context, key string, compute func() (any, error)) (any, error)
RememberForever caches a computed value indefinitely.
type RedisOptions ¶
Click to show internal directories.
Click to hide internal directories.