rexStore

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterType means redis cluster.
	ClusterType = "cluster"
	// NodeType means redis node.
	NodeType = "node"
	// Nil is an alias of redis.Nil.
	Nil = redis.Nil
)

Variables

View Source
var (
	// ErrEmptyHost is an error that indicates no redis host is set.
	ErrEmptyHost = errors.New("empty redis host")
	// ErrEmptyType is an error that indicates no redis type is set.
	ErrEmptyType = errors.New("empty redis type")
	// ErrEmptyDB is an error that indicates no redis key is set.
	ErrEmptyDB = errors.New("empty redis db")
)

Functions

func NewRedisClient

func NewRedisClient(rc *RedisConfig) (*redis.Client, error)

Types

type RedisConfig

type RedisConfig struct {
	Host string
	Type string `json:",default=node,options=node|cluster"`
	User string `json:",optional"`
	Pass string `json:",optional"`
	DB   int    `json:",default=0,optional"`

	NonBlock bool `json:",default=true"`
	// PingTimeout is the timeout for ping redis.
	PingTimeout time.Duration `json:",default=1s"`
	// contains filtered or unexported fields
}

func (*RedisConfig) Validate

func (rc *RedisConfig) Validate() error

Jump to

Keyboard shortcuts

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