Documentation
¶
Index ¶
- type Counter
- type RedisClient
- func (rdb *RedisClient) Close() error
- func (rdb *RedisClient) Decode(encoded string, obj interface{}) error
- func (rdb *RedisClient) Del(ctx context.Context, key string) error
- func (rdb *RedisClient) DelWildcard(ctx context.Context, key string) (int, error)
- func (rdb *RedisClient) Encode(obj interface{}) (string, error)
- func (rdb *RedisClient) Expire(key string, expiration time.Duration) error
- func (rdb *RedisClient) Get(key string) (string, error)
- func (rdb *RedisClient) List(key string) ([]string, error)
- func (rdb *RedisClient) Ping() bool
- func (rdb *RedisClient) PurgeAll() (bool, error)
- func (rdb *RedisClient) Push(ctx context.Context, key string, values []string) error
- func (rdb *RedisClient) Set(ctx context.Context, key string, value string, expiration time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient struct {
Client goredislib.UniversalClient
Redsync *redsync.Redsync
Name string
Mutex map[string]*redsync.Mutex
// contains filtered or unexported fields
}
RedisClient - Redis Client structure.
func (*RedisClient) Decode ¶
func (rdb *RedisClient) Decode(encoded string, obj interface{}) error
Decode - Decodes an object with msgpack.
func (*RedisClient) Del ¶
func (rdb *RedisClient) Del(ctx context.Context, key string) error
Del - Removes a key.
func (*RedisClient) DelWildcard ¶
DelWildcard - Removes the matching keys based on a pattern.
func (*RedisClient) Encode ¶
func (rdb *RedisClient) Encode(obj interface{}) (string, error)
Encode - Encodes an object with msgpack.
func (*RedisClient) Expire ¶
func (rdb *RedisClient) Expire(key string, expiration time.Duration) error
Expire - Sets a TTL on a key (hard eviction only).
func (*RedisClient) List ¶
func (rdb *RedisClient) List(key string) ([]string, error)
List - Returns the values in a list.
func (*RedisClient) PurgeAll ¶
func (rdb *RedisClient) PurgeAll() (bool, error)
PurgeAll - Purges all the existing keys on a DB.
func (*RedisClient) Push ¶
Push - Append values to a list.
Pushing nothing is a no-op, not an error: `RPUSH key` with no members is rejected by Redis with "wrong number of arguments", and go-redis flattens an empty slice into exactly that call. The caller's intent — a list with no entries — is a key that does not exist, which is what every reader here already treats as empty.
This is not hypothetical. StoreMetadata pushes the response's Vary header list, and a response without a Vary header yields an empty one, so every such response failed to store with
Not Stored: ERR wrong number of arguments for 'rpush' command
i.e. the cache stored nothing at all for the ordinary case.