redis

package
v0.2.38 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Master

type Master interface {
	Set(key string, value interface{}, overtime int64) bool
	SetNoFix(key string, value interface{}, overtime int64) bool
	SetNx(key string, value interface{}) bool
	Get(key string, value interface{}) bool
	GetNoFix(key string, value interface{}) bool
	Del(key string) bool
	Ttl(key string) int64
	Expire(key string, overtime int64) bool
	Len(key string) int64
	FlushDB() bool
	Exists(key string) bool
	Keys(key string) []string
	RPush(key string, value ...interface{}) int64
	LPush(key string, value ...interface{}) int64
	LPop(key string, value interface{}) bool
	RPop(key string, value interface{}) bool
	Type(key string) (string, bool)
	Ping() bool
	GetRequirepass() bool
	SetRequirepass(password string) bool
	Select(index int) bool
	HMset(key string, value lib.InRow) bool
	HDel(key string, field ...string) int
	HExists(key string, field string) int
	HGet(key string, field string, value interface{}) bool
	HGetAll(key string) lib.Row
	HLen(key string) int
	HKeys(key string) []string
	HSet(key string, field string, value interface{}) int
	HSetNx(key string, field string, value interface{}) bool
	SAdd(key string, values ...interface{}) int
	SCard(key string) int
	SDiff(keys ...string) [][]byte
	SDiffStore(destination string, keys ...string) int
	SInter(keys ...string) [][]byte
	SInterStore(destination string, keys ...string) int
	SIsMember(key string, value interface{}) bool
	SMembers(key string) [][]byte
	SMove(source, destination string, member interface{}) int
	SPop(key string, value interface{}) bool
	SRandMember(key string, count int) [][]byte
	SRem(key string, members ...interface{}) int
	Push(key string, value interface{}) bool
	Pop(key string, value interface{}) bool
}

Master 从接口

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

Redis redis对象

func (*Redis) Del

func (r *Redis) Del(key string) bool

Del Del操作

func (*Redis) Exists

func (r *Redis) Exists(key string) bool

Exists Exists操作

func (*Redis) Expire

func (r *Redis) Expire(key string, overtime int64) bool

Expire Expire操作

func (*Redis) FlushDB

func (r *Redis) FlushDB() bool

FlushDB FlushDB操作

func (*Redis) Get

func (r *Redis) Get(key string, value interface{}) bool

Get Get操作

func (*Redis) GetNoFix added in v0.0.61

func (r *Redis) GetNoFix(key string, value interface{}) bool

Get Get操作

func (*Redis) GetRequirepass

func (r *Redis) GetRequirepass() bool

GetRequirepass GetRequirepass操作

func (*Redis) HDel

func (r *Redis) HDel(key string, field ...string) int

HDel HDel操作

func (*Redis) HExists

func (r *Redis) HExists(key string, field string) int

HExists HExists操作

func (*Redis) HGet

func (r *Redis) HGet(key string, field string, value interface{}) bool

HGet HGet操作

func (*Redis) HGetAll

func (r *Redis) HGetAll(key string) lib.Row

HGetAll HGetAll操作

func (*Redis) HKeys

func (r *Redis) HKeys(key string) []string

HKeys HKeys操作

func (*Redis) HLen

func (r *Redis) HLen(key string) int

HLen HLen操作

func (*Redis) HMset

func (r *Redis) HMset(key string, value lib.InRow) bool

HMset HMset操作

func (*Redis) HSet

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

HSet HSet操作

func (*Redis) HSetNx

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

HSetNx HSetNx操作

func (*Redis) Keys

func (r *Redis) Keys(key string) []string

Keys Keys操作

func (*Redis) LPop

func (r *Redis) LPop(key string, value interface{}) bool

LPop LPop操作

func (*Redis) LPush

func (r *Redis) LPush(key string, value ...interface{}) int64

LPush LPush操作

func (*Redis) Len

func (r *Redis) Len(key string) int64

Len Len操作

func (*Redis) Master

func (r *Redis) Master() Master

Master 主redis

func (*Redis) Ping

func (r *Redis) Ping() bool

Ping Ping操作

func (*Redis) Pop added in v0.0.3

func (r *Redis) Pop(key string, value interface{}) bool

Push Push操作

func (*Redis) Push added in v0.0.3

func (r *Redis) Push(key string, value interface{}) bool

Push Push操作

func (*Redis) RPop

func (r *Redis) RPop(key string, value interface{}) bool

RPop RPop操作

func (*Redis) RPush

func (r *Redis) RPush(key string, value ...interface{}) int64

RPush RPush操作

func (*Redis) SAdd

func (r *Redis) SAdd(key string, values ...interface{}) int

SAdd SAdd 操作

func (*Redis) SCard

func (r *Redis) SCard(key string) int

SCard SCard 操作

func (*Redis) SDiff

func (r *Redis) SDiff(keys ...string) [][]byte

SDiff SDiff 操作命令返回第一个集合与其他集合之间的差异

func (*Redis) SDiffStore

func (r *Redis) SDiffStore(destination string, keys ...string) int

SDiffStore SDiffStore 命令将给定集合之间的差集存储在指定的集合中

func (*Redis) SInter

func (r *Redis) SInter(keys ...string) [][]byte

SInter SInter 操作

func (*Redis) SInterStore

func (r *Redis) SInterStore(destination string, keys ...string) int

SInterStore SInterStore 操作

func (*Redis) SIsMember

func (r *Redis) SIsMember(key string, value interface{}) bool

SIsMember SIsMember 命令判断成员元素是否是集合的成员。

func (*Redis) SMembers

func (r *Redis) SMembers(key string) [][]byte

SMembers SMembers 命令返回集合中的所有的成员。 不存在的集合 key 被视为空集合。

func (*Redis) SMove

func (r *Redis) SMove(source, destination string, member interface{}) int

SMove SMove 将 member 元素从 source 集合移动到 destination 集合

func (*Redis) SPop

func (r *Redis) SPop(key string, value interface{}) bool

SPop SPop 移除并返回集合中的一个随机元素

func (*Redis) SRandMember

func (r *Redis) SRandMember(key string, count int) [][]byte

SRandMember SRandMember 返回集合中一个或多个随机数

func (*Redis) SRem

func (r *Redis) SRem(key string, members ...interface{}) int

SRem SRem 移除集合中一个或多个成员

func (*Redis) Select

func (r *Redis) Select(index int) bool

Select 选择数据库

func (*Redis) Set

func (r *Redis) Set(key string, value interface{}, overtime int64) bool

Set set操作

func (*Redis) SetNoFix added in v0.0.61

func (r *Redis) SetNoFix(key string, value interface{}, overtime int64) bool

Set set操作

func (*Redis) SetNx

func (r *Redis) SetNx(key string, value interface{}) bool

SetNx SetNx 操作

func (*Redis) SetPool

func (r *Redis) SetPool(pooler RedisPooler) Rediser

SetPool 设置池

func (*Redis) SetRequirepass

func (r *Redis) SetRequirepass(password string) bool

SetRequirepass SetRequirepass操作

func (*Redis) Slave

func (r *Redis) Slave() Master

Slave 从redis

func (*Redis) SlaveByName

func (r *Redis) SlaveByName(name string) Master

SlaveByName 从redis 通过名称

func (*Redis) Ttl

func (r *Redis) Ttl(key string) int64

Ttl Ttl操作

func (*Redis) Type

func (r *Redis) Type(key string) (string, bool)

Type Type操作

type RedisConnect

type RedisConnect struct {
	Master SlaveDB   `json:"master"`
	Slave  []SlaveDB `json:"slave"`
}

RedisConnect 连接配置

func (RedisConnect) String

func (m RedisConnect) String() string

String 连接配置

type RedisPool

type RedisPool struct {
	// contains filtered or unexported fields
}

RedisPool 连接池

func (*RedisPool) GetMaster

func (r *RedisPool) GetMaster() *redis.Pool

GetMaster 获得主redis

func (*RedisPool) GetSlave

func (r *RedisPool) GetSlave() *redis.Pool

GetSlave 获得从redis

func (*RedisPool) GetSlaveByName

func (r *RedisPool) GetSlaveByName(name string) *redis.Pool

GetSlaveByName 获得从redis通过名称

func (*RedisPool) Init

func (r *RedisPool) Init(connect RedisConnect)

Init 初始化

type RedisPooler

type RedisPooler interface {
	GetMaster() *redis.Pool
	GetSlave() *redis.Pool
	GetSlaveByName(name string) *redis.Pool
	Init(connect RedisConnect)
}

RedisPooler 连接池接口

func NewPool

func NewPool(config RedisConnect) RedisPooler

NewPool 初始化数据库连接

type Rediser

type Rediser interface {
	Master() Master
	Slave() Master
	SlaveByName(name string) Master
}

Rediser 操作接口

func NewRedis

func NewRedis() Rediser

NewRedis 新建一个redis

func NewRedisByConnect added in v0.0.35

func NewRedisByConnect(config RedisConnect) Rediser

NewRedisByConnect

type SlaveDB

type SlaveDB struct {
	Name        string `json:"name"`
	Db          int    `json:"db"`
	Password    string `json:"password"`
	Host        string `json:"host"`
	Port        string `json:"port"`
	MaxIdle     int    `json:"maxIdle"`
	IdleTimeout int    `json:"idleTimeout"`
	MaxActive   int    `json:"maxActive"`
}

Slave 从库配置数据

Jump to

Keyboard shortcuts

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