redis

package
v2.0.29 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 5 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) 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) Increase

func (r *Redis) Increase(ctx context.Context, key string) 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