v1

package
v0.0.0-...-806cc7c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ClusterMode = "cluster"
)

Variables

This section is empty.

Functions

func EncodingObject

func EncodingObject(v interface{}) interface{}

func EncodingValues

func EncodingValues(values ...interface{}) interface{}

Types

type Config

type Config struct {
	Mode         string        `yaml:"mode"`
	Addrs        []string      `yaml:"addrs"`
	Password     string        `yaml:"password"`
	DB           int           `yaml:"db"`
	ReadTimeout  time.Duration `yaml:"readTimeout" default:"10s"`
	WriteTimeout time.Duration `yaml:"writeTimeout" default:"20s"`
	PoolSize     int           `yaml:"poolSize"`
	MinIdleConns int           `yaml:"minIdleConns" default:"20"`
	MaxConnAge   time.Duration `yaml:"maxConnAge" default:"80s"`
}

type RedisClient

type RedisClient interface {
	GetRedis() redis.Cmdable
	Set(k string, v interface{}) error
	SetPeriod(k string, v interface{}, period time.Duration) error
	SetNX(k string, v interface{}) error
	SetNXPeriod(k string, v interface{}, period time.Duration) error
	SetEx(k string, v interface{}) error
	SetEXPeriod(k string, v interface{}, period time.Duration) error
	MSet(values ...interface{}) error
	MSetNX(values ...interface{}) error
	Get(k string, v interface{}) error
	GetString(k string) (string, error)
	HSet(key string, value ...interface{}) error
	HGet(key string, field string, v interface{}) error
	HGetString(key string, field string) (string, error)
	HGetAll(key string) (map[string]string, error)
	HDel(key string, field string) error
	Del(k ...string) error
	Expire(k string, period time.Duration) (bool, error)
	Exist(k ...string) (bool, error)
}

func NewRedisClient

func NewRedisClient(config Config) RedisClient

Jump to

Keyboard shortcuts

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