redis

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 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 interface{}) (count int, err error)

func (*Redis) Close

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

func (*Redis) Decr added in v1.0.7

func (r *Redis) Decr(key interface{}) (newValue int64, err error)

func (*Redis) DecrBy added in v1.0.7

func (r *Redis) DecrBy(key interface{}, step int) (newValue int64, err error)

func (*Redis) Del

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

func (*Redis) Do

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

func (*Redis) Exists

func (r *Redis) Exists(key interface{}) (res int, err error)

func (*Redis) Expire

func (r *Redis) Expire(key interface{}, timeoutSecond int64) (ok bool, err error)

func (*Redis) ExpireAt

func (r *Redis) ExpireAt(key interface{}, unixTimestamp int64) (ok bool, err error)

func (*Redis) Get

func (r *Redis) Get(key interface{}) (value interface{}, err error)

region 1.1 String

func (*Redis) GetBit

func (r *Redis) GetBit(key interface{}, offset int) (val int, err error)

func (*Redis) GetBytes added in v0.0.2

func (r *Redis) GetBytes(key interface{}) (value []byte, err error)

func (*Redis) GetInt64

func (r *Redis) GetInt64(key interface{}) (value int64, err error)

func (*Redis) GetRange added in v0.0.2

func (r *Redis) GetRange(key interface{}, start int, end int) (val string, err error)

func (*Redis) GetString

func (r *Redis) GetString(key interface{}) (value string, err error)

func (*Redis) HDel added in v0.0.2

func (r *Redis) HDel(key interface{}, fields ...interface{}) (delCount int, err error)

func (*Redis) HExists added in v0.0.2

func (r *Redis) HExists(key interface{}, field string) (exists bool, err error)

func (*Redis) HGet

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

func (*Redis) HGetAll added in v0.0.2

func (r *Redis) HGetAll(key interface{}) (fieldValues map[string]string, err error)

func (*Redis) HGetInt64

func (r *Redis) HGetInt64(key interface{}, field string) (value int64, err error)

func (*Redis) HGetString

func (r *Redis) HGetString(key interface{}, field string) (value string, err error)

func (*Redis) HIncrBy added in v0.0.2

func (r *Redis) HIncrBy(key interface{}, field string, value int64) (newValue int64, err error)

func (*Redis) HIncrByFloat added in v0.0.2

func (r *Redis) HIncrByFloat(key interface{}, field string, value float64) (newValue float64, err error)

func (*Redis) HKeys added in v0.0.2

func (r *Redis) HKeys(key interface{}) (keyList []string, err error)

func (*Redis) HLen added in v0.0.2

func (r *Redis) HLen(key interface{}) (length int, err error)

func (*Redis) HMGet

func (r *Redis) HMGet(key interface{}, args ...interface{}) (values []string, err error)

func (*Redis) HMGetByArray added in v0.0.2

func (r *Redis) HMGetByArray(key interface{}, fields []string) (values []string, err error)

func (*Redis) HMGetMap

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

func (*Redis) HMSet

func (r *Redis) HMSet(key interface{}, args ...interface{}) (ok bool, err error)

func (*Redis) HMSetByMap added in v0.0.2

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

func (*Redis) HSet

func (r *Redis) HSet(key interface{}, field string, value interface{}) (isNew int, err error)

func (*Redis) HSetNx added in v0.0.2

func (r *Redis) HSetNx(key interface{}, field string, value interface{}) (ok bool, err error)

func (*Redis) Incr added in v1.0.7

func (r *Redis) Incr(key interface{}) (newValue int64, err error)

func (*Redis) IncrBy added in v1.0.7

func (r *Redis) IncrBy(key interface{}, step int) (newValue int64, err error)

func (*Redis) IncrByFloat added in v1.0.7

func (r *Redis) IncrByFloat(key interface{}, step float64) (newValue float64, err error)

func (*Redis) LIndex added in v0.0.2

func (r *Redis) LIndex(key interface{}, index int) (item interface{}, err error)

func (*Redis) LLen added in v0.0.2

func (r *Redis) LLen(key interface{}) (length int, err error)

func (*Redis) LPop added in v0.0.2

func (r *Redis) LPop(key interface{}) (item interface{}, err error)

func (*Redis) LPush added in v0.0.2

func (r *Redis) LPush(key interface{}, items ...interface{}) (totalLength int, err error)

func (*Redis) LRange added in v0.0.2

func (r *Redis) LRange(key interface{}, start int, end int) (items []string, err error)

func (*Redis) LRem added in v0.0.2

func (r *Redis) LRem(key interface{}, count int, value interface{}) (remCount int, err error)

func (*Redis) LSet added in v0.0.2

func (r *Redis) LSet(key interface{}, index int, value interface{}) (ok bool, err error)

func (*Redis) LTrim added in v0.0.2

func (r *Redis) LTrim(key interface{}, start int, end int) (ok bool, err error)

func (*Redis) Multi

func (r *Redis) Multi() *Multi

func (*Redis) Persist

func (r *Redis) Persist(key interface{}) (ok bool, err error)

func (*Redis) RPop added in v0.0.2

func (r *Redis) RPop(key interface{}) (item interface{}, err error)

func (*Redis) RPopLPush added in v0.0.2

func (r *Redis) RPopLPush(source, destination interface{}) (item interface{}, err error)

func (*Redis) RPush added in v0.0.2

func (r *Redis) RPush(key interface{}, items ...interface{}) (totalLength int, err error)

func (*Redis) SAdd added in v0.0.2

func (r *Redis) SAdd(key interface{}, items ...interface{}) (newCount int, err error)

func (*Redis) SCard added in v0.0.2

func (r *Redis) SCard(key interface{}) (total int, err error)

func (*Redis) SIsMember added in v0.0.2

func (r *Redis) SIsMember(key interface{}, item interface{}) (exists bool, err error)

func (*Redis) SMembers added in v0.0.2

func (r *Redis) SMembers(key interface{}) (items []string, err error)

func (*Redis) SPop added in v0.0.2

func (r *Redis) SPop(key interface{}) (item interface{}, 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 interface{}, params ...interface{}) (ok bool, err error)

func (*Redis) SetBit

func (r *Redis) SetBit(key interface{}, offset int, value int) (ok bool, err error)

func (*Redis) SetEx added in v0.0.2

func (r *Redis) SetEx(key interface{}, value interface{}, timeoutSecond int64) (ok bool, err error)

func (*Redis) SetRange

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

func (*Redis) Strlen

func (r *Redis) Strlen(key interface{}) (length int, err error)

func (*Redis) Ttl

func (r *Redis) Ttl(key interface{}) (timeout int64, err error)

func (*Redis) Type

func (r *Redis) Type(key interface{}) (tp string, err error)

func (*Redis) ZAdd added in v0.0.2

func (r *Redis) ZAdd(key interface{}, args ...interface{}) (newCount int, err error)

func (*Redis) ZCard added in v0.0.2

func (r *Redis) ZCard(key interface{}) (total int, err error)

func (*Redis) ZCount added in v0.0.2

func (r *Redis) ZCount(key interface{}, min, max int) (num int, err error)

func (*Redis) ZRange added in v0.0.2

func (r *Redis) ZRange(key interface{}, start, stop int) (items []string, err error)

func (*Redis) ZRangeWithScores added in v0.0.2

func (r *Redis) ZRangeWithScores(key interface{}, start, stop int) (items map[string]string, err error)

func (*Redis) ZRank added in v0.0.2

func (r *Redis) ZRank(key interface{}, item interface{}) (rank int, err error)

func (*Redis) ZRevRange added in v0.0.2

func (r *Redis) ZRevRange(key interface{}, start, stop int) (items []string, err error)

func (*Redis) ZRevRangeWithScores added in v0.0.2

func (r *Redis) ZRevRangeWithScores(key interface{}, start, stop int) (items map[string]string, err error)

Jump to

Keyboard shortcuts

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