redis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package redis

@author: xwc1125

Package redis

@author: xwc1125

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*redis.Client
	// contains filtered or unexported fields
}

func Cache

func Cache() *DB

func New

func New(config RedisConfig) (*DB, error)

func (*DB) ClusterRedis

func (r *DB) ClusterRedis() *redis.ClusterClient

func (*DB) Cmd

func (r *DB) Cmd() redis.Cmdable

Cmd 命令

func (*DB) IsExist

func (r *DB) IsExist(key string) bool

func (*DB) Ping

func (r *DB) Ping() bool

func (*DB) PubSub

func (r *DB) PubSub() redis.UniversalClient

PubSub 订阅

func (*DB) Redis

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

type Mode

type Mode int
const (
	Normal Mode = iota
	Guard
	Cluster
)

type RedisConfig

type RedisConfig struct {
	Mode        Mode     `json:"is_guard" mapstructure:"is_guard"`
	Addr        []string `json:"addr" mapstructure:"addr"`
	Username    string   `json:"username" mapstructure:"username" yaml:"username"`
	Password    string   `json:"password" mapstructure:"password"`
	DB          int      `json:"db" mapstructure:"db"`
	MasterName  string   `json:"master_name" mapstructure:"master_name"`
	CacheExpire int64    `json:"cache_expire" mapstructure:"cache_expire"` // 过期时间[秒]
}

RedisConfig reids配置

Jump to

Keyboard shortcuts

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