hredis

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchValues

func BatchValues(likeKey interface{}) (*gvar.Var, error)

BatchValues 模糊查询key对应所有值(注意,结果集要判空处理)

@likeKey   键

func DeleteKeyValue

func DeleteKeyValue(key interface{}) (*gvar.Var, error)

DeleteKeyValue 删除key及value

@key 键

func Get

func Get(key interface{}) (*gvar.Var, error)

Get 获取string值

@key   键

func HashDel

func HashDel(key interface{}, field interface{}) (*gvar.Var, error)

HashDel 删除哈希表key中的一个指定字段,不存在的字段将被忽略

@key   哈希表key
@field 字段

func HashGet

func HashGet(key interface{}, field interface{}) (*gvar.Var, error)

HashGet 获取存储在哈希表中指定字段的值

@key   哈希表key
@field 字段

func HashSet

func HashSet(key interface{}, field interface{}, value interface{}) (*gvar.Var, error)

HashSet 将哈希表key中的字段field的值设为value

@key   哈希表key
@field 字段
@value 值

func Set

func Set(key interface{}, value interface{}, expire ...uint32) (*gvar.Var, error)

Set 新增string类型

@key   键
@value 值
@expire 过期时间,单位秒(默认不设置,不推荐使用,建议使用SetAndExpire方法)

func SetAndExpire

func SetAndExpire(key interface{}, value interface{}, expire uint32) (*gvar.Var, error)

SetAndExpire 设置key-value并设置过期时间,限定为字符串

@key     键
@value   值
@expire 过期时间,单位秒

func Setnx

func Setnx(key interface{}, value interface{}) (*gvar.Var, error)

Setnx 只有在key不存在时设置key的值(常用于分布式锁)

设置成功,返回1,设置失败,返回0。
@key   键
@value 值

func ZSetAdd

func ZSetAdd(key interface{}, value interface{}, score interface{}) (*gvar.Var, error)

ZSetAdd 新增ZSet数据

@key   集合键
@value 值
@score 分数(小数)

func ZSetCountAll

func ZSetCountAll(key interface{}) (*gvar.Var, error)

ZSetCountAll 查询ZSet总数

@key 集合键

func ZSetPage

func ZSetPage(key interface{}, pageNum, pageSize int, needPageCount ...bool) (*hdto.Page, error)

ZSetPage ZSet集合分页

@key      集合键
@pageNum  当前页码
@pageSize 每页记录数
返回分页对象,注意list集合是*gvar.Var类型

func ZSetRemove

func ZSetRemove(key interface{}, value interface{}) (*gvar.Var, error)

ZSetPage ZSet集合删除指定元素

@key   集合键
@value 要删除的值

Types

This section is empty.

Jump to

Keyboard shortcuts

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