redis

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addrs            []string
	DB               int
	UserName         string
	Password         string
	MasterName       string //when redis sentinel
	SentinelPassword string //when redis sentinel
}

type RedisCli

type RedisCli struct {
	redis.UniversalClient
}

func New

func New(c Config) *RedisCli

func (*RedisCli) Get added in v0.0.2

func (r *RedisCli) Get(ctx context.Context, key string) (res string, err error)

func (*RedisCli) HSetFromStruct

func (r *RedisCli) HSetFromStruct(ctx context.Context, key string, data interface{}) *redis.IntCmd

HSetFromStruct 把struct按hash结构存入redis

func (*RedisCli) HSetFromStructByPip

func (r *RedisCli) HSetFromStructByPip(ctx context.Context, pip *redis.Pipeliner, key string, data interface{}) *redis.IntCmd

HSetFromStructByPip 使用pipeline把struct按hash结构存入redis

Jump to

Keyboard shortcuts

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