redis

package
v2.0.91 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

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

Redis cache implement

func NewRedis

func NewRedis(client *redis.Client, options *redis.Options) (*Redis, error)

NewRedis redis模式

func (*Redis) Decrease

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

func (*Redis) Del

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

Del delete key in redis

func (*Redis) Expire

func (r *Redis) Expire(ctx context.Context, key string, dur time.Duration) error

Expire Set ttl

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, key string) (*gvar.Var, error)

Get from a key

func (*Redis) GetClient

func (r *Redis) GetClient() *redis.Client

GetClient 暴露原生client

func (*Redis) HashDel

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

HashDel delete key in specify redis's hashtable

func (*Redis) HashGet

func (r *Redis) HashGet(ctx context.Context, hk, key string) (*gvar.Var, error)

HashGet from a key

func (*Redis) HashGetAll added in v2.0.32

func (r *Redis) HashGetAll(ctx context.Context, key string) (*gvar.Var, error)

func (*Redis) HashLen added in v2.0.32

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

func (*Redis) HashMGet added in v2.0.37

func (r *Redis) HashMGet(ctx context.Context, key string, fields ...string) (gvar.Vars, error)

func (*Redis) HashMSet added in v2.0.37

func (r *Redis) HashMSet(ctx context.Context, key string, fields map[string]interface{}) error

func (*Redis) HashSet added in v2.0.32

func (r *Redis) HashSet(ctx context.Context, key string, fields map[string]interface{}) (int64, error)

func (*Redis) HashVals added in v2.0.68

func (r *Redis) HashVals(ctx context.Context, key string) (gvar.Vars, error)

func (*Redis) Increase

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

func (*Redis) ListLPush added in v2.0.72

func (r *Redis) ListLPush(ctx context.Context, key string, values ...interface{}) (int64, error)

func (*Redis) ListRPop added in v2.0.70

func (r *Redis) ListRPop(ctx context.Context, key string, count ...int) (*gvar.Var, error)

func (*Redis) ListRange added in v2.0.71

func (r *Redis) ListRange(ctx context.Context, key string, start, stop int64) (gvar.Vars, error)

func (*Redis) Set

func (r *Redis) Set(ctx context.Context, key string, val interface{}, expire int) error

Set value with key and expire time

func (*Redis) String

func (*Redis) String() string

Jump to

Keyboard shortcuts

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