redis

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 17 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)

Types

type Cache

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

func New

func New(opts ...Option) *Cache

func (*Cache) Decrement

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

func (*Cache) Delete

func (c *Cache) Delete(key string) (int64, error)

Delete 删除

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) 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, error)

LPush 左进

func (*Cache) RPop

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

RPop 右出

func (*Cache) ReleaseLock

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

func (*Cache) Set

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

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) XAdd

func (c *Cache) XAdd(key, id string, values []string) (string, error)

func (*Cache) XDel

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

func (*Cache) XRead

func (c *Cache) XRead(key string, count int64) (interface{}, error)

XRead default type []redis.XStream

func (*Cache) ZAdd added in v0.2.7

func (c *Cache) ZAdd(key string, score float64, member interface{}) interface{}

func (*Cache) ZRangeByScore added in v0.2.7

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

func (*Cache) ZRem added in v0.2.7

func (c *Cache) ZRem(key string, members ...interface{}) error

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, cmders []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