redis

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDefault = Config{
	Host:      "127.0.0.1",
	Port:      6379,
	Username:  "",
	Password:  "",
	URL:       "",
	Database:  0,
	Reset:     false,
	TLSConfig: nil,
	KeyPrefix: "",
}

默认配置

Functions

This section is empty.

Types

type Config

type Config struct {
	Host      string
	Port      int
	Username  string
	Password  string
	Database  int
	URL       string
	Reset     bool
	TLSConfig *tls.Config
	KeyPrefix string
}

配置 https://pkg.go.dev/github.com/go-redis/redis/v8#Options

type Redis

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

*

  • redis *
  • @create 2022-7-6
  • @author deatil

func Manager

func Manager(typ string) *Redis

redis 存储

func New

func New(config ...Config) *Redis

构造函数

func Storage

func Storage() *Redis

Redis Storage().Get(key string) ([]byte, error) Storage().Set(key string, val []byte, exp time.Duration) Storage().Delete(key string) error Storage().Reset() error Storage().Close()

func (*Redis) Close

func (this *Redis) Close() error

关闭

func (*Redis) Delete

func (this *Redis) Delete(key string) error

删除

func (*Redis) FormatKey

func (this *Redis) FormatKey(key string) string

格式化 key

func (*Redis) Get

func (this *Redis) Get(key string) ([]byte, error)

获取

func (*Redis) GetClient

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

获取客户端

func (*Redis) GetCtx

func (this *Redis) GetCtx() context.Context

获取上下文

func (*Redis) Reset

func (this *Redis) Reset() error

重设

func (*Redis) Set

func (this *Redis) Set(key string, val []byte, exp time.Duration) error

设置

Jump to

Keyboard shortcuts

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