redis

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(config map[string]interface{}) *redis.Pool

*

  • 连接redis

func ToInt

func ToInt(data interface{}) int

*

  • 转字符串

func ToString

func ToString(data interface{}) string

*

  • 转字符串

Types

type RedisClient

type RedisClient struct {
	Conn *redis.Pool
	OK   string
}

func NewClient

func NewClient(config map[string]interface{}) *RedisClient

*

  • 获取客户端连接

func (*RedisClient) Blpop

func (this *RedisClient) Blpop(key string, timeout int) []string

*

  • 堵塞读取数据

func (*RedisClient) BrPopLpush

func (this *RedisClient) BrPopLpush(key, key1 string, timeout int) string

*

  • 堵塞读取数据

func (*RedisClient) Brpop

func (this *RedisClient) Brpop(key string, timeout int) []string

*

  • 堵塞读取数据

func (*RedisClient) Command

func (this *RedisClient) Command(cmd string, keys ...interface{}) (str string, err error)

*

  • 获取redis数据

func (*RedisClient) Del

func (this *RedisClient) Del(key string) (bool, error)

*

  • 获取redis数据

func (*RedisClient) Get

func (this *RedisClient) Get(key string) string

*

  • 存储数据

func (*RedisClient) Hdel

func (this *RedisClient) Hdel(key string, agrs ...interface{}) int

*

  • 删除一个或多个哈希表字段

func (*RedisClient) Hexists

func (this *RedisClient) Hexists(key string, agrs ...interface{}) int

*

  • 查看哈希表 key 中,指定的字段是否存在。

func (*RedisClient) Hget

func (this *RedisClient) Hget(key string, agrs ...interface{}) string

*

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

func (*RedisClient) Hgetall

func (this *RedisClient) Hgetall(key string) map[string]string

*

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

func (*RedisClient) Hkeys

func (this *RedisClient) Hkeys(key string) []string

*

  • 命令用于获取哈希表中的所有域。

func (*RedisClient) Hlen

func (this *RedisClient) Hlen(key string) int

*

  • 用于获取哈希表中字段的数量。

func (*RedisClient) Hmget

func (this *RedisClient) Hmget(key string, field interface{}) string

*

  • 获取所有给定字段的值。

func (*RedisClient) Hmset

func (this *RedisClient) Hmset(key string, field, value interface{}) bool

*

  • 此命令会覆盖哈希表中已存在的字段。

func (*RedisClient) Lindex

func (this *RedisClient) Lindex(key string, index int) string

*

  • 通过索引获取列表中的元素

func (*RedisClient) Llen

func (this *RedisClient) Llen(key string) int

*

  • 读取列表长度

func (*RedisClient) Lpop

func (this *RedisClient) Lpop(key string) string

*

  • 读取列表数据

func (*RedisClient) Lpush

func (this *RedisClient) Lpush(key string, args ...interface{}) int

*

  • 插入列表数据

func (*RedisClient) Lrem

func (this *RedisClient) Lrem(key string, count int, value interface{}) int

*

  • 删除列表数据

func (*RedisClient) RedisExpire

func (this *RedisClient) RedisExpire(key string, expire int)

*

  • 设置时效性

func (*RedisClient) Rpop

func (this *RedisClient) Rpop(key string) string

*

  • 读取列表数据

func (*RedisClient) RpopLpush

func (this *RedisClient) RpopLpush(key, key1 string) (string, error)

*

  • 移除列表的最后一个元素,并将该元素添加到另一个列表

func (*RedisClient) Set

func (this *RedisClient) Set(key, str string, args ...int) bool

*

  • 存储数据

func (*RedisClient) SetNx

func (this *RedisClient) SetNx(key, str string, args ...int) bool

*

  • 存储数据判断

Jump to

Keyboard shortcuts

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