luaredis

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyIsEmpty       = errors.New("key is allowed not empty")
	ValuesIsEmpty    = errors.New("value is allowed not empty")
	TtlIsNoAllowed   = errors.New("ttl is not allowed 0 or less than 0")
	DbIsNoAllowed    = errors.New("ttl is not less than 0")
	HashFieldIsEmpty = errors.New("hash field is empty")
)

Functions

This section is empty.

Types

type GLRHash

type GLRHash struct{}

func NewGLRHash

func NewGLRHash() *GLRHash

func (*GLRHash) HDelHashField

func (glh *GLRHash) HDelHashField(rdb *redis.Client, key []string, field string) error

HDelHashField delete hash filed

func (*GLRHash) HExistsHashField

func (glh *GLRHash) HExistsHashField(rdb *redis.Client, key []string, field string) (int, error)

HExistsHashField exists hash filed

func (*GLRHash) HGetAllHashField

func (glh *GLRHash) HGetAllHashField(rdb *redis.Client, key []string) ([]string, error)

HGetAllHashField get all hash field

func (*GLRHash) HGetHashFiled

func (glh *GLRHash) HGetHashFiled(rdb *redis.Client, key []string, field string) (interface{}, error)

HGetHashFiled get hash filed

func (*GLRHash) HIncrByFloat32HashField

func (glh *GLRHash) HIncrByFloat32HashField(rdb *redis.Client, key []string, field string, number float32)

HIncrByFloat32HashField incr for give float32 number

func (*GLRHash) HIncrByFloat64HashField

func (glh *GLRHash) HIncrByFloat64HashField(rdb *redis.Client, key []string, field string, number float64)

HIncrByFloat64HashField incr for give float64 number

func (*GLRHash) HIncrByNumberHashField

func (glh *GLRHash) HIncrByNumberHashField(rdb *redis.Client, key []string, field string, number int64)

HIncrByNumberHashField incr for given number

func (*GLRHash) HIncrHashField

func (glh *GLRHash) HIncrHashField(rdb *redis.Client, key []string, field string)

HIncrHashField incr 1

func (*GLRHash) HKeysHash

func (glh *GLRHash) HKeysHash(rdb *redis.Client, key []string) ([]string, error)

HKeysHash return all keys list

func (*GLRHash) HLenHash

func (glh *GLRHash) HLenHash(rdb *redis.Client, key []string) (int, error)

HLenHash len hash

func (*GLRHash) HSetHashKey

func (glh *GLRHash) HSetHashKey(rdb *redis.Client, key []string, field string, value interface{}) error

HSetHashKey set hash filed value

func (*GLRHash) HValsHash

func (glh *GLRHash) HValsHash(rdb *redis.Client, key []string) ([]interface{}, error)

HValsHash hash all valis

type GLRList

type GLRList struct{}

func NewGLRList

func NewGLRList() *GLRList

func (*GLRList) ListLen

func (lrl *GLRList) ListLen(rdb *redis.Client, key []string) int64

ListLen list len

func (*GLRList) ListPop

func (lrl *GLRList) ListPop(rdb *redis.Client, key []string) interface{}

ListPop pop list

func (*GLRList) ListPush

func (lrl *GLRList) ListPush(rdb *redis.Client, key []string, value interface{}) int64

ListPush push element into list

type GLRPubSub

type GLRPubSub struct{}

func NewPubSub

func NewPubSub() *GLRPubSub

func (*GLRPubSub) Publish

func (ps *GLRPubSub) Publish(rdb *redis.Client, channel []string, message interface{}) (int, error)

func (*GLRPubSub) Subscribe

func (ps *GLRPubSub) Subscribe(rdb *redis.Client, channel []string)

type GLRSet

type GLRSet struct{}

func NewGLRSet

func NewGLRSet() *GLRSet

func (*GLRSet) SMembers

func (lrs *GLRSet) SMembers(rdb *redis.Client, key []string) ([]interface{}, error)

SMembers members of set

func (*GLRSet) SetSAdd

func (lrs *GLRSet) SetSAdd(rdb *redis.Client, key []string, value interface{}) interface{}

SetSAdd add element

type GLRSortedSet

type GLRSortedSet struct{}

func NewGLRSortedSet

func NewGLRSortedSet() *GLRSortedSet

func (*GLRSortedSet) SetZAdd

func (lss *GLRSortedSet) SetZAdd(rdb *redis.Client, key []string, score, value interface{}) error

SetZAdd add sorted set element

func (*GLRSortedSet) SetZRange

func (lss *GLRSortedSet) SetZRange(rdb *redis.Client, key []string, start, end int) ([]interface{}, error)

SetZRange range of sorted

type GLRedis

type GLRedis struct{}

func NewGLRedis

func NewGLRedis() *GLRedis

func (*GLRedis) DelKey

func (glr *GLRedis) DelKey(rdb *redis.Client, key []string) (int64, error)

DelKey del for given key success return 1, failed return 0

func (*GLRedis) ExistsKey

func (glr *GLRedis) ExistsKey(rdb *redis.Client, key []string) (int64, error)

ExistsKey check key is exists for given key exists return 1, is not exists return 0

func (*GLRedis) ExpireKey

func (glr *GLRedis) ExpireKey(rdb *redis.Client, key []string, ttl int) (int64, error)

ExpireKey success return 1, failed return 0 unit time second

func (*GLRedis) GetKey

func (glr *GLRedis) GetKey(rdb *redis.Client, key []string) (string, error)

GetKey get value for given key

func (*GLRedis) GetOrSetWithExpire

func (glr *GLRedis) GetOrSetWithExpire(rdb *redis.Client, key []string, val string, ttl int) (string, error)

GetOrSetWithExpire get not exist, do set unit time second

func (*GLRedis) GetOrSetWithoutExpire

func (glr *GLRedis) GetOrSetWithoutExpire(rdb *redis.Client, key []string, val string) (string, error)

GetOrSetWithoutExpire get not exist, do set

func (*GLRedis) MoveKeyToDb

func (glr *GLRedis) MoveKeyToDb(rdb *redis.Client, key []string, db int) (int64, error)

MoveKeyToDb move to selected db for given key

func (*GLRedis) PatternKeys

func (glr *GLRedis) PatternKeys(rdb *redis.Client, key []string) ([]string, error)

PatternKeys return list for given pattern keys

func (*GLRedis) PtlKey

func (glr *GLRedis) PtlKey(rdb *redis.Client, key []string) (int64, error)

PtlKey return ttl for given key return unit time second

func (*GLRedis) SetWithExpire

func (glr *GLRedis) SetWithExpire(rdb *redis.Client, key []string, val string, ttl int) (string, error)

SetWithExpire set value with expire for given key unit time second

func (*GLRedis) SetWithoutExpire

func (glr *GLRedis) SetWithoutExpire(rdb *redis.Client, key []string, val string) (string, error)

SetWithoutExpire set value without expire for given key

type GoLuaRedisHash

type GoLuaRedisHash interface {
	HSetHashKey(rdb *redis.Client, key []string, field string, value interface{}) error
	HDelHashField(rdb *redis.Client, key []string, field string) error
	HGetHashFiled(rdb *redis.Client, key []string, field string) (interface{}, error)
	HExistsHashField(rdb *redis.Client, key []string, field string) (int, error)
	HGetAllHashField(rdb *redis.Client, key []string) ([]string, error)
	HIncrHashField(rdb *redis.Client, key []string, field string)
	HIncrByNumberHashField(rdb *redis.Client, key []string, field string, number int64)
	HIncrByFloat64HashField(rdb *redis.Client, key []string, field string, number float64)
	HIncrByFloat32HashField(rdb *redis.Client, key []string, field string, number float32)
	HKeysHash(rdb *redis.Client, key []string) ([]string, error)
	HValsHash(rdb *redis.Client, key []string) ([]interface{}, error)
	HLenHash(rdb *redis.Client, key []string) (int, error)
}

type GoLuaRedisList

type GoLuaRedisList interface {
	ListPush(rdb *redis.Client, key []string, value interface{}) int64
	ListLen(rdb *redis.Client, key []string) int64
	ListPop(rdb *redis.Client, key []string) interface{}
}

type GoLuaRedisPubSub

type GoLuaRedisPubSub interface {
	Publish(rdb *redis.Client, channel []string, message interface{}) (int, error)
	Subscribe(rdb *redis.Client, channel []string) interface{}
}

type GoLuaRedisSet

type GoLuaRedisSet interface {
	SetSAdd(rdb *redis.Client, key []string, value interface{}) int
	SMembers(rdb *redis.Client, key []string) ([]interface{}, error)
}

type GoLuaRedisSortedSet

type GoLuaRedisSortedSet interface {
	SetZAdd(rdb *redis.Client, key []string, score interface{}, value interface{}) error
	SetZRange(rdb *redis.Client, key []string, start, end int) ([]interface{}, error)
}

type GoLuaRedisString

type GoLuaRedisString interface {
	SetWithExpire(rdb *redis.Client, key []string, val string, ttl int) (string, error)
	SetWithoutExpire(rdb *redis.Client, key []string, val string) (string, error)
	GetKey(rdb *redis.Client, key []string) (string, error)
	GetOrSetWithExpire(rdb *redis.Client, key []string, val string, ttl int) (string, error)
	GetOrSetWithoutExpire(rdb *redis.Client, key []string, val string) (string, error)
	DelKey(rdb *redis.Client, key []string) (int64, error)
	ExistsKey(rdb *redis.Client, key []string) (int64, error)
	ExpireKey(rdb *redis.Client, key []string, ttl int) (int64, error)
	PatternKeys(rdb *redis.Client, key []string) ([]string, error)
	PtlKey(rdb *redis.Client, key []string) (int64, error)
	MoveKeyToDb(rdb *redis.Client, key []string, db int) (int64, error)
}

Jump to

Keyboard shortcuts

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