gredis

package module
v0.0.0-...-2ec97ad Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MulanPSL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Addr        string
	MaxIdle     int
	MaxActive   int
	IdleTimeout time.Duration
	Wait        bool
	DB          string
	PassWord    string
}

func (*Conf) SetPool

func (c *Conf) SetPool() redis.Pool

type ReidsConn

type ReidsConn struct {
	redis.Conn
}

func SetConn

func SetConn(pool redis.Pool) ReidsConn

func (ReidsConn) Append

func (r ReidsConn) Append(key string, value interface{}) error

往key追加值

func (ReidsConn) Decrby

func (r ReidsConn) Decrby(key string, num int) error

值减num

func (ReidsConn) Del

func (r ReidsConn) Del(key string) error

删除key

func (ReidsConn) Exists

func (r ReidsConn) Exists(key string) (bool, error)

检查key是否存在

func (ReidsConn) Expire

func (r ReidsConn) Expire(key string, second time.Duration) error

设置key的过期时间

func (ReidsConn) Get

func (r ReidsConn) Get(key string) (string, error)

获取字符串的值

func (ReidsConn) GetSet

func (r ReidsConn) GetSet(key string, value interface{}) (string, error)

设置key的新值,同时返回key的旧值

func (ReidsConn) HDecrby

func (r ReidsConn) HDecrby(key, field string, num int) error

哈希表字段的值减num

func (ReidsConn) HDel

func (r ReidsConn) HDel(key string, field string) error

删除哈希字段

func (ReidsConn) HGet

func (r ReidsConn) HGet(key, field string) (string, error)

获取哈希字段的值

func (ReidsConn) HGetall

func (r ReidsConn) HGetall(key string) (map[string]string, error)

获取所有的哈希字段的值

func (ReidsConn) HIncrby

func (r ReidsConn) HIncrby(key, field string, num int) error

哈希表字段的值加num

func (ReidsConn) HKeys

func (r ReidsConn) HKeys(key string) ([]string, error)

获取哈希字段

func (ReidsConn) HLen

func (r ReidsConn) HLen(key string) (int64, error)

哈希表字段数量

func (ReidsConn) HMset

func (r ReidsConn) HMset(key string, field map[string]string) error

同时设置多个哈希字段

func (ReidsConn) HSet

func (r ReidsConn) HSet(key string, field string, value interface{}) error

建立哈希表自字段

func (ReidsConn) HVals

func (r ReidsConn) HVals(key string) ([]string, error)

获取哈希表所有的值

func (ReidsConn) Incrby

func (r ReidsConn) Incrby(key string, num int) error

值加num

func (ReidsConn) LIndex

func (r ReidsConn) LIndex(key string, index int) (string, error)

根据索引index获取列表元素

func (ReidsConn) LInsertAfter

func (r ReidsConn) LInsertAfter(key string, value, pirot interface{}) error

在指定元素pitot后面插入value

func (ReidsConn) LInsertBefore

func (r ReidsConn) LInsertBefore(key string, value, pirot interface{}) error

在指定元素pitot前面插入value

func (ReidsConn) LPop

func (r ReidsConn) LPop(key string) (string, error)

从左边移除第一个元素

func (ReidsConn) LPush

func (r ReidsConn) LPush(key string, value ...interface{}) error

从左边插入value

func (ReidsConn) LRange

func (r ReidsConn) LRange(key string, start, end int) ([]string, error)

获取指定范围内的所有元素

func (ReidsConn) LRem

func (r ReidsConn) LRem(key string, value interface{}, count int) error

删除list中count个的value元素 当count<0时,从右到左开始,删除|count|个value元素 当count>0时,从左到右开始,删除count个value元素 放count=0时,删除lint中所有的value元素

func (ReidsConn) LTrim

func (r ReidsConn) LTrim(key string, start, end int) error

删除区间之外的所有元素

func (ReidsConn) RPop

func (r ReidsConn) RPop(key string) (string, error)

从右边移除第一个元素

func (ReidsConn) RPush

func (r ReidsConn) RPush(key string, value ...interface{}) error

从右边插入value

func (ReidsConn) Rename

func (r ReidsConn) Rename(key, newkey string) error

重命名key

func (ReidsConn) SAdd

func (r ReidsConn) SAdd(key string, value ...interface{}) error

想集合key添加成员

func (ReidsConn) SCard

func (r ReidsConn) SCard(key string) (int, error)

获取结合key的成员总数

func (ReidsConn) SDiff

func (r ReidsConn) SDiff(key string, others ...string) ([]string, error)

集合key与其他集合others相较,获取集合key独有的元素

func (ReidsConn) SInter

func (r ReidsConn) SInter(key string, others ...string) ([]string, error)

返回所有集合的交集

func (ReidsConn) SIsmenber

func (r ReidsConn) SIsmenber(key string, member interface{}) (bool, error)

判断member是否为key的成员

func (ReidsConn) SMembers

func (r ReidsConn) SMembers(key string) ([]string, error)

显示集合所有成员

func (ReidsConn) SMove

func (r ReidsConn) SMove(key1, key2 string, member interface{}) error

将key1的成员member移动到key2中

func (ReidsConn) SPop

func (r ReidsConn) SPop(key string, count int) ([]string, error)

移除集合count个成员,并将其返回

func (ReidsConn) SRem

func (r ReidsConn) SRem(key string, members ...interface{}) error

删除集合成员

func (ReidsConn) SUnion

func (r ReidsConn) SUnion(key ...string) ([]string, error)

返回所有集合的并集

func (ReidsConn) Set

func (r ReidsConn) Set(key string, value interface{}) error

设置字符串key的值

func (ReidsConn) Setex

func (r ReidsConn) Setex(key string, value interface{}, second time.Duration) error

设置字符擦的值,同时设置过期时间

func (ReidsConn) StrLen

func (r ReidsConn) StrLen(key string) (int64, error)

获取字符串的长度

func (ReidsConn) ZAdd

func (r ReidsConn) ZAdd(key string, score int, member interface{}) error

设置有序集合的值

func (ReidsConn) ZCard

func (r ReidsConn) ZCard(key string) (int, error)

获取有序集合的成员数

func (ReidsConn) ZCount

func (r ReidsConn) ZCount(key string, min, max int) (int, error)

计算min,max区间中所有成员的总分数

func (ReidsConn) ZDecrby

func (r ReidsConn) ZDecrby(key string, incrememt int, member interface{}) (int, error)

有序集合key的member成员分数减incrment

func (ReidsConn) ZIncrby

func (r ReidsConn) ZIncrby(key string, incrememt int, member interface{}) (int, error)

有序集合key的member成员分数加incrment

func (ReidsConn) ZRange

func (r ReidsConn) ZRange(key string, start, end int) ([]string, error)

获取索引start,end区间内的所有成员

func (ReidsConn) ZRank

func (r ReidsConn) ZRank(key string, member interface{}) (int, error)

获取指定member成员的索引

func (ReidsConn) ZRem

func (r ReidsConn) ZRem(key string, members ...interface{}) error

删除成员

func (ReidsConn) ZScore

func (r ReidsConn) ZScore(key string, member interface{}) (int, error)

获取所有成员的总分数

Jump to

Keyboard shortcuts

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