internal

package
v0.0.0-...-ef901e4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCmd

type RedisCmd interface {
	Ping(ctx context.Context) error

	Publish(ctx context.Context, channel pubsub.RedisChannelID, message interface{}) error
	PSubscribeFunc() pubsub.RedisSubscribeRawFunc

	Get(ctx context.Context, key string) (*string, error)
	MGet(ctx context.Context, keys ...string) ([]*string, error)
	TTL(ctx context.Context, key string) (*time.Duration, error)
	// EXPIRE command set TTL of the entry, not discarding the entry (name came from https://redis.io/commands/expire)
	Expire(ctx context.Context, key string, ttl time.Duration) error
	Set(ctx context.Context, key string, value interface{}) error
	SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) error
	Del(ctx context.Context, key string) error

	LoadScript(ctx context.Context, script *redis.Script) error
	RunScript(ctx context.Context, script *redis.Script, keys []string, args ...interface{}) (interface{}, error)
}

RedisCmd wraps Redis command system

func NewRedisCmd

func NewRedisCmd(raw redis.Cmdable, psubscribeFunc pubsub.RedisSubscribeRawFunc) RedisCmd

NewRedisCmd creates new RedisCmd instance.

type RedisConnection

type RedisConnection struct {
	RedisCmd RedisCmd
	Close    func() error

	IsSingleNode bool
	IsCluster    bool

	MaxConnections int
}

RedisConnection represents Redis connection system

func NewRedisConnection

func NewRedisConnection(ctx context.Context, config *config.RedisStorageConfig) (RedisConnection, error)

NewRedisConnection establish connection pool to Redis server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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