redis

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

func NewGroup

func NewGroup(options []Option, ring hash.Ring) *Group

func (*Group) Get

func (g *Group) Get(key interface{}) (pool *Pool, err error)

func (*Group) Index

func (g *Group) Index(i int) (pool *Pool, err error)

type Multi

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

func (*Multi) ExecMulti

func (m *Multi) ExecMulti(redis *Redis) (results []interface{}, err error)

func (*Multi) ExecPipeline

func (m *Multi) ExecPipeline(redis *Redis) (results []interface{}, err error)

func (*Multi) Send

func (m *Multi) Send(cmd string, args ...interface{}) (multi *Multi)

type Option

type Option struct {
	Host string `yaml:"host" json:"host"`
	Port string `yaml:"port" json:"port"`
	Auth string `yaml:"auth" json:"auth"`
	Db   uint8  `yaml:"db" json:"db"`
	//单位s
	MaxConnLifetime int  `yaml:"maxConnLifetime" json:"maxConnLifetime"`
	MaxIdle         int  `yaml:"maxIdle" json:"maxIdle"`
	MaxActive       int  `yaml:"maxActive" json:"maxActive"`
	Wait            bool `yaml:"wait" json:"wait"`
	//单位ms
	ConnectTimeout int `yaml:"connectTimeout" json:"connectTimeout"`
	//单位ms
	ReadTimeout int `yaml:"readTimeout" json:"readTimeout"`
	//单位ms
	WriteTimeout int `yaml:"writeTimeout" json:"writeTimeout"`
}

type Pool

type Pool struct {
	boot.CanHash
	// contains filtered or unexported fields
}

func NewPool

func NewPool(option *Option) (pool *Pool)

func (*Pool) Get

func (p *Pool) Get() (redis *Redis)

func (*Pool) HashCode

func (p *Pool) HashCode() (hashValue uint32)

func (*Pool) Put

func (p *Pool) Put(redis *Redis)

type Redis

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

func (*Redis) BitCount

func (r *Redis) BitCount(key []byte) (count int, err error)

func (*Redis) Close

func (r *Redis) Close() (err error)

释放连接到连接池,并非真正的close

func (*Redis) Del

func (r *Redis) Del(keys ...interface{}) (successCount int64, err error)

func (*Redis) Do

func (r *Redis) Do(cmd string, args ...interface{}) (reply interface{}, err error)

func (*Redis) Exists

func (r *Redis) Exists(key []byte) (exists bool, err error)

region 1.0 Key

func (*Redis) Expire

func (r *Redis) Expire(key []byte, timeoutSecond int64) (ok bool, err error)

func (*Redis) ExpireAt

func (r *Redis) ExpireAt(key []byte, unixTimestamp int64) (ok bool, err error)

func (*Redis) Get

func (r *Redis) Get(key []byte) (value []byte, err error)

region 1.1 String

func (*Redis) GetBit

func (r *Redis) GetBit(key []byte, offset int) (val int, err error)

func (*Redis) GetInt

func (r *Redis) GetInt(key []byte) (value int, err error)

func (*Redis) GetInt64

func (r *Redis) GetInt64(key []byte) (value int64, err error)

func (*Redis) GetString

func (r *Redis) GetString(key []byte) (value string, err error)

func (*Redis) HGet

func (r *Redis) HGet(key []byte, field []byte) (value []byte, err error)

func (*Redis) HGetInt

func (r *Redis) HGetInt(key []byte, field []byte) (value int, err error)

func (*Redis) HGetInt64

func (r *Redis) HGetInt64(key []byte, field []byte) (value int64, err error)

func (*Redis) HGetString

func (r *Redis) HGetString(key []byte, field []byte) (value string, err error)

func (*Redis) HMGet

func (r *Redis) HMGet(key []byte, fields []string) (values []string, err error)

func (*Redis) HMGetMap

func (r *Redis) HMGetMap(key []byte, fields []string) (fieldValues map[string]string, err error)

func (*Redis) HMSet

func (r *Redis) HMSet(key []byte, fieldValues map[string]interface{}) (ok bool, err error)

func (*Redis) HSet

func (r *Redis) HSet(key []byte, field []byte, value interface{}) (exists bool, err error)

region 1.3 Hash

func (*Redis) Multi

func (r *Redis) Multi() *Multi

func (*Redis) Persist

func (r *Redis) Persist(key []byte) (ok bool, err error)

func (*Redis) Scan

func (r *Redis) Scan(cursor int64, pattern string, count int64) (nextCursor int64, keys [][]byte, err error)

func (*Redis) ScanStrings

func (r *Redis) ScanStrings(cursor int64, pattern string, count int64) (nextCursor int64, keys []string, err error)

func (*Redis) Send

func (r *Redis) Send(cmd string, args ...interface{}) (err error)

func (*Redis) Set

func (r *Redis) Set(key []byte, params ...interface{}) (ok bool, err error)

func (*Redis) SetBit

func (r *Redis) SetBit(key []byte, offset int, value int) (ok bool, err error)

func (*Redis) SetRange

func (r *Redis) SetRange(key []byte, offset int, value []byte) (length int, err error)

region 1.2 Bit

func (*Redis) SetTimeout

func (r *Redis) SetTimeout(key []byte, value interface{}, timeoutSecond int64) (ok bool, err error)

func (*Redis) Strlen

func (r *Redis) Strlen(key []byte) (length int, err error)

func (*Redis) Ttl

func (r *Redis) Ttl(key []byte) (timeout int64, err error)

func (*Redis) Type

func (r *Redis) Type(key []byte) (tp string, err error)

Jump to

Keyboard shortcuts

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