client

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter added in v1.3.1

type Counter struct {
	// contains filtered or unexported fields
}

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 Connect

func Connect(connName string, config config.Cache, logger *log.Logger) *RedisClient

Connect - Connects to DB.

func (*RedisClient) Close

func (rdb *RedisClient) Close() error

Close - Closes the connection.

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

func (rdb *RedisClient) DelWildcard(ctx context.Context, key string) (int, error)

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) Get

func (rdb *RedisClient) Get(key string) (string, error)

Get - Gets a key.

func (*RedisClient) List

func (rdb *RedisClient) List(key string) ([]string, error)

List - Returns the values in a list.

func (*RedisClient) Ping

func (rdb *RedisClient) Ping() bool

Ping - Tests the connection.

func (*RedisClient) PurgeAll

func (rdb *RedisClient) PurgeAll() (bool, error)

PurgeAll - Purges all the existing keys on a DB.

func (*RedisClient) Push

func (rdb *RedisClient) Push(ctx context.Context, key string, values []string) error

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.

func (*RedisClient) Set

func (rdb *RedisClient) Set(ctx context.Context, key string, value string, expiration time.Duration) (bool, error)

Set - Sets a key, with certain value, with TTL for expiring (soft and hard eviction).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL