xredis

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisClient added in v0.0.3

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

func NewRedisClusterClient added in v0.0.3

func NewRedisClusterClient(opts ...ClusterOption) *redis.ClusterClient

Types

type ClusterOption added in v0.0.3

type ClusterOption func(*redis.ClusterOptions)

func WithClusterAddr added in v0.0.3

func WithClusterAddr(addr []string) ClusterOption

func WithClusterDialTimeout added in v0.0.3

func WithClusterDialTimeout(d time.Duration) ClusterOption

func WithClusterReadTimeout added in v0.0.3

func WithClusterReadTimeout(d time.Duration) ClusterOption

func WithClusterWriteTimeout added in v0.0.3

func WithClusterWriteTimeout(d time.Duration) ClusterOption

type Config

type Config struct {
	Addr         []string `yaml:"addr"`
	DB           int      `yaml:"db"`
	Type         string   `yaml:"type"`
	DialTimeout  int      `yaml:"dial_timeout"`
	ReadTimeout  int      `yaml:"read_timeout"`
	WriteTimeout int      `yaml:"write_timeout"`
}

type Option added in v0.0.3

type Option func(*redis.Options)

func WithAddr added in v0.0.3

func WithAddr(addr string) Option

func WithDB added in v0.0.3

func WithDB(db int) Option

func WithDialTimeout added in v0.0.3

func WithDialTimeout(d time.Duration) Option

func WithReadTimeout added in v0.0.3

func WithReadTimeout(d time.Duration) Option

func WithWriteTimeout added in v0.0.3

func WithWriteTimeout(d time.Duration) Option

type XRedis

type XRedis struct {
	redis.Cmdable
}

func NewXRedis added in v0.0.3

func NewXRedis(conf *Config) *XRedis

func (*XRedis) ExistEX

func (xr *XRedis) ExistEX(ctx context.Context, key string, ttl time.Duration) error

func (*XRedis) HGetXEX

func (xr *XRedis) HGetXEX(ctx context.Context, key, field string, ttl time.Duration) (string, error)

func (*XRedis) HIncrByXEX

func (xr *XRedis) HIncrByXEX(ctx context.Context, key, field string, incr int64, ttl time.Duration) error

func (*XRedis) HMGetXEX

func (xr *XRedis) HMGetXEX(ctx context.Context, key string, ttl time.Duration, field ...string) ([]interface{}, error)

func (*XRedis) HMIncrByEX

func (xr *XRedis) HMIncrByEX(ctx context.Context, key string, fieldMap map[string]int64, ttl time.Duration) error

func (*XRedis) HMSetEX

func (xr *XRedis) HMSetEX(ctx context.Context, key string, fieldMap map[string]interface{}, ttl time.Duration) error

func (*XRedis) HMSetXEX

func (xr *XRedis) HMSetXEX(ctx context.Context, key string, fieldMap map[string]interface{}, ttl time.Duration) error

func (*XRedis) IncrByXEX

func (xr *XRedis) IncrByXEX(ctx context.Context, key string, incr int64, ttl time.Duration) error

func (*XRedis) ZAddEX

func (xr *XRedis) ZAddEX(ctx context.Context, key string, zs []*redis.Z, ttl time.Duration) error

func (*XRedis) ZAddXEX

func (xr *XRedis) ZAddXEX(ctx context.Context, key string, zs []*redis.Z, ttl time.Duration) error

func (*XRedis) ZRevPageByMember added in v0.0.7

func (xr *XRedis) ZRevPageByMember(ctx context.Context, key string, member interface{}, offset int64) ([]interface{}, error)

func (*XRedis) ZRevPageByMemberWithScores added in v0.0.7

func (xr *XRedis) ZRevPageByMemberWithScores(ctx context.Context, key string, member interface{}, offset int64) ([]redis.Z, error)

func (*XRedis) ZRevRangeByMember

func (xr *XRedis) ZRevRangeByMember(ctx context.Context, key string, member interface{}, offset int64) ([]interface{}, error)

func (*XRedis) ZRevRangeByMemberWithScores

func (xr *XRedis) ZRevRangeByMemberWithScores(ctx context.Context, key string, member interface{}, offset int64) ([]redis.Z, error)

Jump to

Keyboard shortcuts

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