redisd

package
v1.3.28 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nil = redis.Nil
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.3.28

type Client interface {
	redis.Cmdable
	Do(ctx context.Context, args ...interface{}) *redis.Cmd
	Subscribe(ctx context.Context, channels ...string) *redis.PubSub
}

type Config

type Config struct {
	Addr             string `yaml:"addr"`
	Passwd           string `yaml:"passwd"`
	LocalCache       bool   `yaml:"localCache"`
	Chanel           string `yaml:"chanel"`
	Size             int    `yaml:"size"`
	LocalExpire      int    `yaml:"localExpire"`
	RedisLocalExpire int    `yaml:"redisLocalExpire"`
	FailSleep        int64  `yaml:"failSleep"`
	FailWaitCount    int64  `yaml:"failWaitCount"`
}

type Decorator

type Decorator struct {
	Client
	// contains filtered or unexported fields
}

func InitRedis

func InitRedis(cnf Config) *Decorator

func (*Decorator) BfMAdd

func (r *Decorator) BfMAdd(ctx context.Context, key string, values ...string) ([]interface{}, error)

func (*Decorator) BfMExists

func (r *Decorator) BfMExists(ctx context.Context, key string, values ...string) ([]interface{}, error)

func (*Decorator) Del

func (r *Decorator) Del(ctx context.Context, key string) error

func (*Decorator) DelKeys

func (r *Decorator) DelKeys(ctx context.Context, key string)

func (*Decorator) EitherLock

func (r *Decorator) EitherLock(ctx context.Context, key string, lockBack bool) (string, int64)

单向锁

func (*Decorator) Get

func (r *Decorator) Get(ctx context.Context, key string) (string, error)

func (*Decorator) GetObj

func (r *Decorator) GetObj(ctx context.Context, key string, obj interface{}) error

func (*Decorator) GetSet

func (r *Decorator) GetSet(ctx context.Context, key string, expire time.Duration, getFormDb func() (string, error)) (string, error)

func (*Decorator) GetSetObj

func (r *Decorator) GetSetObj(ctx context.Context, key string, obj interface{}, expire time.Duration, getFormDb func() (interface{}, error)) error

func (*Decorator) GetSetObjRefKey

func (r *Decorator) GetSetObjRefKey(ctx context.Context, key string, obj interface{}, expire time.Duration, getFormDb func() (interface{}, error)) error

func (*Decorator) HSetExEval

func (r *Decorator) HSetExEval(ctx context.Context, key, field, value string, seconds int32) error

func (*Decorator) IncrEx

func (r *Decorator) IncrEx(ctx context.Context, key string, expire, count int32) (int64, error)

func (*Decorator) IncrLimitEx

func (r *Decorator) IncrLimitEx(ctx context.Context, key string, expire, count, limit int32) (int64, error)

增加count大于Limit

func (*Decorator) IncrThanEx

func (r *Decorator) IncrThanEx(ctx context.Context, key string, expire, count, than int32) (int64, error)

增加count不能超过than

func (*Decorator) Limit

func (r *Decorator) Limit(ctx context.Context, key string, duration time.Duration, count int32) (bool, error)

func (*Decorator) Lock

func (r *Decorator) Lock(ctx context.Context, key string, outTime int32) int64

func (*Decorator) SAddEx

func (r *Decorator) SAddEx(ctx context.Context, key, value string, seconds int32) (int64, error)

func (*Decorator) Set

func (r *Decorator) Set(ctx context.Context, key string, value string, expire time.Duration) error

func (*Decorator) SetObj

func (r *Decorator) SetObj(ctx context.Context, key string, obj interface{}, expire time.Duration) error

func (*Decorator) SetObjRefKey

func (r *Decorator) SetObjRefKey(ctx context.Context, key string, obj interface{}, expire time.Duration) error

type XAddArgs

type XAddArgs struct {
	redis.XAddArgs
	Partition int32 //分区数
}

Jump to

Keyboard shortcuts

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