redis

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//redis部分
	ErrorsRedisInitConnFail string = "初始化redis连接池失败"
	ErrorsRedisAuthFail     string = "Redis Auth 鉴权失败,密码错误"
	ErrorsRedisGetConnFail  string = "Redis 从连接池获取一个连接失败,超过最大重试次数"
)

Variables

This section is empty.

Functions

func Init

func Init()

Types

type RedisClient

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

定义一个redis客户端结构体

func GetOneRedisClient

func GetOneRedisClient() *RedisClient

从连接池获取一个redis连接

func GetOneRedisClientIndex

func GetOneRedisClientIndex(databaseIndex int) *RedisClient

func (*RedisClient) Bool

func (r *RedisClient) Bool(reply interface{}, err error) (bool, error)

bool 类型转换

func (*RedisClient) Bytes

func (r *RedisClient) Bytes(reply interface{}, err error) ([]byte, error)

Bytes 类型转换

func (*RedisClient) Execute

func (r *RedisClient) Execute(cmd string, args ...interface{}) (interface{}, error)

为redis-go 客户端封装统一操作函数入口

func (*RedisClient) Float64

func (r *RedisClient) Float64(reply interface{}, err error) (float64, error)

Float64 类型转换

func (*RedisClient) Int

func (r *RedisClient) Int(reply interface{}, err error) (int, error)

int 类型转换

func (*RedisClient) Int64

func (r *RedisClient) Int64(reply interface{}, err error) (int64, error)

int64 类型转换

func (*RedisClient) ReleaseOneRedisClient

func (r *RedisClient) ReleaseOneRedisClient()

释放连接到连接池

func (*RedisClient) Result

func (r *RedisClient) Result(key string, reply interface{}, err error) *RedisResult

封装几个数据类型转换的函数

func (*RedisClient) Results

func (r *RedisClient) Results(keys []string, reply interface{}, err error) *RedisResults

封装几个数据类型转换的函数

func (*RedisClient) String

func (r *RedisClient) String(reply interface{}, err error) (string, error)

string 类型转换

func (*RedisClient) Strings

func (r *RedisClient) Strings(reply interface{}, err error) ([]string, error)

strings 类型转换

func (*RedisClient) Uint64

func (r *RedisClient) Uint64(reply interface{}, err error) (uint64, error)

uint64 类型转换

type RedisLock

type RedisLock struct {
	*RedisClient
	// contains filtered or unexported fields
}

func NewRedisLock

func NewRedisLock(client *RedisClient, key string) *RedisLock

func (*RedisLock) Lock

func (l *RedisLock) Lock(timeout ...int) (bool, error)

func (*RedisLock) Locked

func (l *RedisLock) Locked() bool

func (*RedisLock) TryLock

func (l *RedisLock) TryLock() bool

func (*RedisLock) Unlock

func (l *RedisLock) Unlock()

type RedisResult

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

func (*RedisResult) As

func (r *RedisResult) As(data interface{}) error

func (*RedisResult) Bool

func (r *RedisResult) Bool() (bool, error)

bool 类型转换

func (*RedisResult) Bytes

func (r *RedisResult) Bytes() ([]byte, error)

Bytes 类型转换

func (*RedisResult) Float64

func (r *RedisResult) Float64() (float64, error)

Float64 类型转换

func (*RedisResult) Int

func (r *RedisResult) Int() (int, error)

int 类型转换

func (*RedisResult) Int64

func (r *RedisResult) Int64() (int64, error)

int64 类型转换

func (*RedisResult) String

func (r *RedisResult) String() (string, error)

string 类型转换

func (*RedisResult) Strings

func (r *RedisResult) Strings() ([]string, error)

strings 类型转换

func (*RedisResult) Uint64

func (r *RedisResult) Uint64() (uint64, error)

uint64 类型转换

type RedisResults

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

func (*RedisResults) AsStringList

func (rs *RedisResults) AsStringList() []string

func (*RedisResults) AsStringMap

func (rs *RedisResults) AsStringMap() map[string]string

func (*RedisResults) List

func (rs *RedisResults) List() []*RedisResult

func (*RedisResults) Map

func (rs *RedisResults) Map() map[string]*RedisResult

type RedisStorage

type RedisStorage struct {
	*RedisClient
	// contains filtered or unexported fields
}

func NewRedisStorage

func NewRedisStorage(database int) *RedisStorage

func (*RedisStorage) Lock

func (s *RedisStorage) Lock(key string)

func (*RedisStorage) ReenLock

func (s *RedisStorage) ReenLock(key string)

func (*RedisStorage) Restore

func (s *RedisStorage) Restore(key string) *RedisResult

func (*RedisStorage) RestoreHash

func (s *RedisStorage) RestoreHash(key string) *RedisResult

func (*RedisStorage) RestoreHashValue

func (s *RedisStorage) RestoreHashValue(key string, hashKey string) *RedisResult

func (*RedisStorage) RestoreKeys

func (s *RedisStorage) RestoreKeys(keys []string) *RedisResults

func (*RedisStorage) RestoreList

func (s *RedisStorage) RestoreList(key string) *RedisResult

func (*RedisStorage) RestoreListHead

func (s *RedisStorage) RestoreListHead(key string) *RedisResult

func (*RedisStorage) RestoreListTail

func (s *RedisStorage) RestoreListTail(key string) *RedisResult

func (*RedisStorage) RestoreSet

func (s *RedisStorage) RestoreSet(key string) *RedisResult

func (*RedisStorage) RestoreSets

func (s *RedisStorage) RestoreSets(keys []string) *RedisResult

func (*RedisStorage) RestoreZSet

func (s *RedisStorage) RestoreZSet(key string) *RedisResult

func (*RedisStorage) Store

func (s *RedisStorage) Store(key string, value interface{}) error

func (*RedisStorage) StoreAsString

func (s *RedisStorage) StoreAsString(key string, value interface{}) error

func (*RedisStorage) StoreAsStringDuration

func (s *RedisStorage) StoreAsStringDuration(key string, value interface{}, duration time.Duration) error

func (*RedisStorage) StoreAsStringDurationIfAbsent

func (s *RedisStorage) StoreAsStringDurationIfAbsent(key string, value interface{}, duration time.Duration) (string, error)

func (*RedisStorage) StoreAsStringExpire

func (s *RedisStorage) StoreAsStringExpire(key string, value interface{}, expireTime time.Time) error

func (*RedisStorage) StoreAsStringIfAbsent

func (s *RedisStorage) StoreAsStringIfAbsent(key string, value interface{}) (string, error)

func (*RedisStorage) StoreDuration

func (s *RedisStorage) StoreDuration(key string, value interface{}, duration time.Duration) error

func (*RedisStorage) StoreDurationIfAbsent

func (s *RedisStorage) StoreDurationIfAbsent(key string, value interface{}, duration time.Duration) (string, error)

func (*RedisStorage) StoreExpire

func (s *RedisStorage) StoreExpire(key string, value interface{}, expireTime time.Time) error

func (*RedisStorage) StoreHashValue

func (s *RedisStorage) StoreHashValue(key string, hashKey string, value interface{}) (int, error)

func (*RedisStorage) StoreHashValueAsString

func (s *RedisStorage) StoreHashValueAsString(key string, value interface{}) (int, error)

func (*RedisStorage) StoreHashValues

func (s *RedisStorage) StoreHashValues(key string, values map[string]interface{}) (int, error)

func (*RedisStorage) StoreHashValuesAsString

func (s *RedisStorage) StoreHashValuesAsString(key string, values map[string]interface{}) (int, error)

func (*RedisStorage) StoreIfAbsent

func (s *RedisStorage) StoreIfAbsent(key string, value interface{}) (string, error)

func (*RedisStorage) StoreListValue

func (s *RedisStorage) StoreListValue(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValueAsString

func (s *RedisStorage) StoreListValueAsString(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValueHead

func (s *RedisStorage) StoreListValueHead(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValueHeadAsString

func (s *RedisStorage) StoreListValueHeadAsString(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValueTail

func (s *RedisStorage) StoreListValueTail(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValueTailAsString

func (s *RedisStorage) StoreListValueTailAsString(key string, value interface{}) (int, error)

func (*RedisStorage) StoreListValues

func (s *RedisStorage) StoreListValues(key string, values []interface{}) (int, error)

func (*RedisStorage) StoreListValuesAsString

func (s *RedisStorage) StoreListValuesAsString(key string, values []interface{}) (int, error)

func (*RedisStorage) StoreSetValue

func (s *RedisStorage) StoreSetValue(key string, value interface{}) (int, error)

func (*RedisStorage) StoreSetValueAsString

func (s *RedisStorage) StoreSetValueAsString(key string, value interface{}) (int, error)

func (*RedisStorage) StoreSetValues

func (s *RedisStorage) StoreSetValues(key string, values []interface{}) (int, error)

func (*RedisStorage) StoreSetValuesAsString

func (s *RedisStorage) StoreSetValuesAsString(key string, values []interface{}) (int, error)

func (*RedisStorage) StoreZSetValue

func (s *RedisStorage) StoreZSetValue(key string, score int, value interface{}) (int, error)

func (*RedisStorage) StoreZSetValueAsString

func (s *RedisStorage) StoreZSetValueAsString(key string, score int, value interface{}) (int, error)

func (*RedisStorage) TryLock

func (s *RedisStorage) TryLock(key string) bool

func (*RedisStorage) TryReenLock

func (s *RedisStorage) TryReenLock(key string) bool

func (*RedisStorage) Unlock

func (s *RedisStorage) Unlock(key string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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