package
0.0.0-20241103125305-e02cc373744a
Repository: https://github.com/violetpupil/gos.git
Documentation: pkg.go.dev
# Functions
BLPop 阻塞弹出第一个元素 如果多个键都有元素,只弹出指定顺序靠前的一个键 返回切片,第一个元素是list名,第二个元素是值 A timeout of zero can be used to block indefinitely.
Decr 将指定键的值减1,返回减小后的值 键不存在的话,先创建键并设置为0,后执行操作 https://redis.io/commands/decr/.
Expire 设置过期时间 键不存在或者选项条件不满足,返回 false 代表设置失败 The timeout will only be cleared by commands that delete or overwrite the contents of the key, including DEL, SET, GETSET and all the *STORE commands.
Get 获取字符串键值 键不存在的话,返回 redis.Nil 错误 https://redis.io/commands/get/.
GetDel 获取字符串键值,然后删除 键不存在的话,返回 redis.Nil 错误 https://redis.io/commands/getdel/.
Incr 将指定键的值加1,返回增加后的值 键不存在的话,先创建键并设置为0,后执行操作 https://redis.io/commands/incr/.
Init 初始化客户端 初始化时不会连接 redis.
LMove 移动元素 pos为left或right https://redis.io/commands/lmove/ Available since: 6.2.0.
LPop 弹出第一个元素 key不存在时,返回redis.Nil错误 https://redis.io/commands/lpop/.
LRem 移除元素 Return the number of removed elements.
NewClient 创建redis客户端.
RPush 在尾部添加元素 Return the length of the list after the push operation.
SAdd set add 返回添加成功的元素数 https://redis.io/commands/sadd/.
Set 设置字符串,0代表不过期 https://redis.io/commands/set/.
SetNX 设置字符串 如果不存在 0代表不过期 返回bool表示是否设置成功.
SPop set pop 当key不存在时,返回redis.Nil错误 https://redis.io/commands/spop/.
SRem set rem 返回移除成功的元素数 https://redis.io/commands/srem/.
ZAdd 添加元素 如果元素存在,更新得分 返回添加的元素数,不包括更新 https://redis.io/commands/zadd/.
ZAddNX 添加元素 如果元素存在,不更新得分 返回添加的元素数 https://redis.io/commands/zadd/.
ZRange 获取有序集合元素 根据索引 start stop 前后包含 zrange key 0 -1 获取全部元素 Out of range indexes do not produce an error.
ZRangeByScore 获取有序集合元素 根据得分 start stop 前后包含 zrange key -inf +inf byScore 获取全部元素.
ZRangeWithScores 获取有序集合元素 包含得分.
ZRem 移除元素值 https://redis.io/commands/zrem/.
ZRemRangeByScore 移除元素 根据得分 https://redis.io/commands/zremrangebyscore/.
# Variables
Nil 当键不存在时,有的命令会返回 Nil 错误.