gtredis

package module
v0.0.0-...-7f1e80a Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncrementMessageID

func IncrementMessageID(id string) (string, error)

incrementMessageID takes in a message ID (e.g. 1564886140363-0) and increments the index section (e.g. 1564886140363-1). This is the next valid ID value, and it can be used for paging through messages.

func NewRedisClient

func NewRedisClient(options *RedisOptions) *redis.Client

newRedisClient creates a new Redis client with the given options. If options is nil, it will use default options.

func RedisPreflightChecks

func RedisPreflightChecks(client redis.UniversalClient) error

redisPreflightChecks makes sure the Redis instance backing the *redis.Client offers the functionality we need. Specifically, it also that it can connect to the actual instance and that the instance supports Redis streams (i.e. it's at least v5).

Types

type Redis

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

func NewRedis

func NewRedis(c *redis.Client) *Redis

NewRedis 初始化locker

func (*Redis) Lock

func (r *Redis) Lock(key string, ttl int64, options *locker.Options) (*locker.Lock, error)

func (Redis) String

func (Redis) String() string

type RedisOptions

type RedisOptions = redis.Options

RedisOptions is an alias to redis.Options so that users can this instead of having to import go-redis directly.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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