redis

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_GROUP_NAME = "default"
	DEFAULT_REDIS_PORT = 6379
)
View Source
const (
	DEFAULT_POOL_IDLE_TIMEOUT = 60 * time.Second
	DEFAULT_POOL_CONN_TIMEOUT = 10 * time.Second
	DEFAULT_POOL_MAX_LIFETIME = 60 * time.Second
)

Variables

This section is empty.

Functions

func ClearConfig

func ClearConfig()

func RemoveConfig

func RemoveConfig(name ...string)

func SetConfigByStr

func SetConfigByStr(str string, name ...string) error

Types

type Config

type Config struct {
	Host            string
	Port            int
	Db              int
	Passwd          string
	MaxIdle         int
	MaxActive       int
	IdleTimeout     time.Duration
	MaxConnLifetime time.Duration
	ConnectTimeout  time.Duration
}

func ConfigFromStr

func ConfigFromStr(str string) (config Config, err error)

func GetConfig

func GetConfig(name ...string) (config Config, ok bool)

type Conn

type Conn struct {
	redis.Conn
}

type PoolStats

type PoolStats struct {
	redis.PoolStats
}

type Redis

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

func Instance

func Instance(name ...string) *Redis

func New

func New(config Config) *Redis

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) Conn

func (r *Redis) Conn() *Conn

func (*Redis) Do

func (r *Redis) Do(command string, args ...interface{}) (interface{}, error)

func (*Redis) DoVar

func (r *Redis) DoVar(command string, args ...interface{}) (*gvar.Var, error)

func (*Redis) GetConn

func (r *Redis) GetConn() *Conn

func (*Redis) SetIdleTimeout

func (r *Redis) SetIdleTimeout(value time.Duration)

func (*Redis) SetMaxActive

func (r *Redis) SetMaxActive(value int)

func (*Redis) SetMaxConnLifetime

func (r *Redis) SetMaxConnLifetime(value time.Duration)

func (*Redis) SetMaxIdle

func (r *Redis) SetMaxIdle(value int)

func (*Redis) Stats

func (r *Redis) Stats() *PoolStats

Jump to

Keyboard shortcuts

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