redis

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSet

type DataSet struct {
	Key   string
	Value any
}

type Options

type Options struct {
	URI string
	DB  int
	Exp int
}

type Redis

type Redis struct {
	*redis.Client
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(opt *Options) (*Redis, error)

func NewRedisSentinel

func NewRedisSentinel(opt *SentinelOptions) (*Redis, error)

func (*Redis) Del

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

func (*Redis) DeleteWithPattern

func (r *Redis) DeleteWithPattern(ctx context.Context, pattern string) error

DeleteWithPattern clear cache with a pattern

func (*Redis) Exists

func (r *Redis) Exists(ctx context.Context, key ...string) bool

func (*Redis) GetInt

func (r *Redis) GetInt(ctx context.Context, key string) (int, error)

func (*Redis) GetMembers

func (r *Redis) GetMembers(ctx context.Context, key string, obj interface{}, opts ...*options.Options) (int, error)

func (*Redis) GetObject

func (r *Redis) GetObject(ctx context.Context, key string, value interface{}, opts ...*options.Options) error

GetObject get cache object

func (*Redis) GetString

func (r *Redis) GetString(ctx context.Context, key string) (string, error)

func (*Redis) MGet

func (r *Redis) MGet(ctx context.Context, keys []string, obj interface{}, opts ...*options.Options) error

MGet get cache with multiple keys

func (*Redis) RemainingTime

func (r *Redis) RemainingTime(ctx context.Context, key string) int

func (*Redis) Set

func (r *Redis) Set(ctx context.Context, key string, value interface{}, opts ...*options.Options) error

Set cache will use the default expiration if the expiration is not filled

func (*Redis) SetMember

func (r *Redis) SetMember(ctx context.Context, key string, data []*DataSet, opts ...*options.Options) error

func (*Redis) SetMultiple

func (r *Redis) SetMultiple(ctx context.Context, data []*DataSet, opts ...*options.Options) error

type SentinelOptions

type SentinelOptions struct {
	URI string
	DB  int
	Exp int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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