storage

package
v0.0.0-...-cc59c3f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MGet

func MGet(ctx context.Context, r Redis, keys []string) [][]byte

批量获取 Redis 中的多个键对应的值

func MSet

func MSet(ctx context.Context, r Redis, m map[string]interface{}) error

批量设置 Redis 中的多个键值对

func New

func New(cfg ormx.DBConfig) (*gorm.DB, error)

Types

type Redis

type Redis redis.Cmdable

定义了一个 Redis 接口,用于表示 Redis 客户端对象

func NewRedis

func NewRedis(cfg RedisConfig) (Redis, error)

创建并初始化一个 Redis 客户端对象 根据配置的 RedisType 类型不同(standalone、cluster、sentinel),创建相应类型的 Redis 客户端

type RedisConfig

type RedisConfig struct {
	Address  string
	Username string
	Password string
	DB       int
	UseTLS   bool
	tlsx.ClientConfig
	RedisType        string
	MasterName       string
	SentinelUsername string
	SentinelPassword string
}

Redis 连接配置

Jump to

Keyboard shortcuts

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