redis

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCmd

func AppendCmd(b []byte, cmd redis.Cmder) []byte

func CmdString

func CmdString(cmd redis.Cmder) string

func CmdsString

func CmdsString(cmds []redis.Cmder) (string, string)

func Marshal added in v0.2.15

func Marshal(value interface{}) ([]byte, error)

func NewRedisClient added in v0.2.15

func NewRedisClient(opts ...Option) *redis.Client

func Unmarshal added in v0.2.15

func Unmarshal(byt []byte, ptr interface{}) (err error)

Types

type Cache

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

func New

func New(opts ...Option) *Cache

func (*Cache) BRPopLPush added in v0.3.1

func (c *Cache) BRPopLPush(source string, destination string, timeout time.Duration) string

func (*Cache) Decrement

func (c *Cache) Decrement(key string, value int64) (int64, error)

func (*Cache) Delete

func (c *Cache) Delete(key ...string) int64

Delete 删除

func (*Cache) Exists added in v0.2.15

func (c *Cache) Exists(keys ...string) int64

func (*Cache) Flush

func (c *Cache) Flush()

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

func (*Cache) GetLock

func (c *Cache) GetLock(lockName string, acquireTimeout, lockTimeOut time.Duration) (string, error)

func (*Cache) GetString

func (c *Cache) GetString(key string) (string, error)

func (*Cache) HashAll added in v0.2.19

func (c *Cache) HashAll(key string) map[string]string

func (*Cache) HashDel added in v0.2.19

func (c *Cache) HashDel(key string, values ...string) int64

func (*Cache) HashExist added in v0.2.19

func (c *Cache) HashExist(key, values string) bool

func (*Cache) HashGet added in v0.2.19

func (c *Cache) HashGet(key, value string) string

func (*Cache) HashGets added in v0.2.19

func (c *Cache) HashGets(key string, value ...string) []interface{}

func (*Cache) HashKeys added in v0.2.19

func (c *Cache) HashKeys(key string) []string

func (*Cache) HashLen added in v0.2.19

func (c *Cache) HashLen(key string) int64

func (*Cache) HashSet added in v0.2.19

func (c *Cache) HashSet(key string, values ...interface{}) int64

func (*Cache) Increment

func (c *Cache) Increment(key string, value int64) (int64, error)

func (*Cache) IncrementFloat

func (c *Cache) IncrementFloat(key string, value float64) (float64, error)

func (*Cache) IsExist

func (c *Cache) IsExist(key string) bool

IsExist 判断key是否存在

func (*Cache) LPush

func (c *Cache) LPush(key string, values ...interface{}) int64

LPush 左进

func (*Cache) LRange added in v0.3.1

func (c *Cache) LRange(key string, start int64, stop int64) []string

func (*Cache) LRem added in v0.3.1

func (c *Cache) LRem(key string, count int64, value interface{}) int64

func (*Cache) Pipeline added in v0.2.15

func (c *Cache) Pipeline() redis.Pipeliner

func (*Cache) RPop

func (c *Cache) RPop(key string) string

RPop 右出

func (*Cache) RPopLPush added in v0.3.1

func (c *Cache) RPopLPush(source string, destination string) string

func (*Cache) ReleaseLock

func (c *Cache) ReleaseLock(lockName, code string) bool

func (*Cache) Scan added in v0.3.1

func (c *Cache) Scan(cursor uint64, match string, count int64) ([]string, uint64)

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}, timeout time.Duration) error

func (*Cache) SetEX added in v0.3.1

func (c *Cache) SetEX(key string, value interface{}, timeout time.Duration) error

func (*Cache) SetNX added in v0.3.1

func (c *Cache) SetNX(key string, value interface{}, expiration time.Duration) bool

func (*Cache) WithContext

func (c *Cache) WithContext(ctx context.Context) cache.ICache

func (*Cache) WithDB

func (c *Cache) WithDB(db int) cache.ICache

func (*Cache) XAck added in v0.2.15

func (c *Cache) XAck(key string, group string, ids ...string) int64

func (*Cache) XAdd

func (c *Cache) XAdd(key, msgId string, trim bool, maxLength int64, value interface{}) string

func (*Cache) XAddKey added in v0.2.18

func (c *Cache) XAddKey(key, msgId string, trim bool, maxLength int64, vKey string, value interface{}) string

func (*Cache) XClaim added in v0.2.15

func (c *Cache) XClaim(key string, group string, consumer string, id string, msIdle int64) []redis.XMessage

func (*Cache) XDel

func (c *Cache) XDel(key string, id ...string) int64

func (*Cache) XGroupCreateMkStream added in v0.2.15

func (c *Cache) XGroupCreateMkStream(key string, group string, start string) string

func (*Cache) XGroupDelConsumer added in v0.2.15

func (c *Cache) XGroupDelConsumer(key string, group string, consumer string) int64

func (*Cache) XGroupDestroy added in v0.2.15

func (c *Cache) XGroupDestroy(key string, group string) int64

func (*Cache) XGroupSetID added in v0.2.15

func (c *Cache) XGroupSetID(key string, group string, start string) string

func (*Cache) XInfoConsumers added in v0.2.15

func (c *Cache) XInfoConsumers(key string, group string) []redis.XInfoConsumer

func (*Cache) XInfoGroups added in v0.2.15

func (c *Cache) XInfoGroups(key string) []redis.XInfoGroup

func (*Cache) XInfoStream added in v0.2.15

func (c *Cache) XInfoStream(key string) *redis.XInfoStream

func (*Cache) XLen added in v0.2.15

func (c *Cache) XLen(key string) int64

func (*Cache) XPending added in v0.2.15

func (c *Cache) XPending(key string, group string) *redis.XPending

func (*Cache) XPendingExt added in v0.2.15

func (c *Cache) XPendingExt(key string, group string, startId string, endId string, count int64, consumer ...string) []redis.XPendingExt

func (*Cache) XRange added in v0.2.15

func (c *Cache) XRange(key string, start string, stop string) []redis.XMessage

func (*Cache) XRangeN added in v0.2.15

func (c *Cache) XRangeN(key string, start string, stop string, count int64) []redis.XMessage

func (*Cache) XRead

func (c *Cache) XRead(key string, startId string, count int64, block int64) []redis.XMessage

XRead default type []redis.XStream

func (*Cache) XReadGroup added in v0.2.15

func (c *Cache) XReadGroup(key string, group string, consumer string, count int64, block int64, id ...string) []redis.XMessage

func (*Cache) XTrimMaxLen added in v0.2.15

func (c *Cache) XTrimMaxLen(key string, maxLen int64) int64

func (*Cache) ZAdd added in v0.2.7

func (c *Cache) ZAdd(key string, score float64, value ...interface{}) int64

func (*Cache) ZRangeByScore added in v0.2.7

func (c *Cache) ZRangeByScore(key string, min int64, max int64, offset int64, count int64) []string

func (*Cache) ZRem added in v0.2.7

func (c *Cache) ZRem(key string, value ...interface{}) int64

type Option

type Option func(p *config)

func WithAddr

func WithAddr(addr string) Option

WithAddr prevents addr.

func WithAttributes

func WithAttributes(attrs ...string) Option

WithAttributes specifies additional attributes to be added to the span.

func WithDB

func WithDB(db int) Option

WithDB prevents db.

func WithLogger

func WithLogger(logger glog.ILogger) Option

WithLogger prevents logger.

func WithPassword

func WithPassword(password string) Option

WithPassword prevents password.

func WithPort

func WithPort(port int) Option

WithPort prevents port.

func WithTracer

func WithTracer(tracerServer *tracer.Server) Option

WithTracer specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

type TracingHook

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

func (*TracingHook) AfterProcess

func (h *TracingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*TracingHook) AfterProcessPipeline

func (h *TracingHook) AfterProcessPipeline(ctx context.Context, cmder []redis.Cmder) error

func (*TracingHook) BeforeProcess

func (h *TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*TracingHook) BeforeProcessPipeline

func (h *TracingHook) BeforeProcessPipeline(ctx context.Context, cmd []redis.Cmder) (context.Context, error)

Jump to

Keyboard shortcuts

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