redis

package
v0.0.0-...-0227cab Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil     = redis.ErrNil
	Int        = redis.Int
	Ints       = redis.Ints
	IntMap     = redis.IntMap
	Int64      = redis.Int64
	Int64s     = redis.Int64s
	Int64Map   = redis.Int64Map
	Uint64     = redis.Uint64
	Uint64s    = redis.Uint64s
	Uint64Map  = redis.Uint64Map
	Float64    = redis.Float64
	Float64s   = redis.Float64s
	Float64Map = redis.Float64Map
	String     = redis.String
	Strings    = redis.Strings
	StringMap  = redis.StringMap
	Bytes      = redis.Bytes
	ByteSlices = redis.ByteSlices
	Bool       = redis.Bool
	Values     = redis.Values
	Positions  = redis.Positions
)

Functions

This section is empty.

Types

type Address

type Address string

func (Address) Host

func (a Address) Host() string

func (Address) Port

func (a Address) Port() int

func (Address) ToString

func (a Address) ToString() string

type AuthConfig

type AuthConfig struct {
	Username  string
	Password  string
	TLSConfig *tls.Config
}

type ClusterNode

type ClusterNode struct {
	Id        string
	Addr      string
	RawFlag   string
	MasterId  string
	PingSend  int64
	PongRecv  int64
	Epoch     int64
	LinkState string
	Slots     []string

	Role string
}

func ParseNodeFromClusterNode

func ParseNodeFromClusterNode(line string) (*ClusterNode, error)

func (*ClusterNode) IsSelf

func (n *ClusterNode) IsSelf() bool

type ClusterNodes

type ClusterNodes []*ClusterNode

func (ClusterNodes) Self

func (ns ClusterNodes) Self() *ClusterNode

type RedisClient

type RedisClient interface {
	Do(ctx context.Context, cmd string, args ...any) (any, error)
	Pipelining(ctx context.Context, cmds []string, args [][]any) (interface{}, error)
	Close() error

	Ping(ctx context.Context) error
	Info(ctx context.Context) (*RedisInfo, error)
	ConfigGet(ctx context.Context, cate string) (map[string]string, error)
	ConfigSet(ctx context.Context, params map[string]string) error
	Nodes(ctx context.Context) (ClusterNodes, error)
}

RedisClient

func NewRedisClient

func NewRedisClient(addr string, authInfo AuthConfig) RedisClient

NewRedisClient

type RedisInfo

type RedisInfo struct {
	RedisVersion          string             `json:"redis_version"`
	RedisMode             string             `json:"redis_mode"`
	RunId                 string             `json:"run_id"`
	UptimeInSeconds       string             `json:"uptime_in_seconds"`
	AOFEnabled            string             `json:"aof_enabled"`
	Role                  string             `json:"role"`
	MasterHost            string             `json:"master_host"`
	MasterPort            string             `json:"master_port"`
	ClusterEnabled        string             `json:"cluster_enabled"`
	MasterLinkStatus      string             `json:"master_link_status"`
	MasterReplOffset      int64              `json:"master_repl_offset"`
	UsedMemoryDataset     int64              `json:"used_memory_dataset"`
	SentinelMasters       int64              `json:"sentinel_masters"`
	SentinelTiLt          int64              `json:"sentinel_tilt"`
	SentinelRunningScript int64              `json:"sentinel_running_scripts"`
	SentinelMaster0       SentinelMasterInfo `json:"master0"`
	ConnectedReplicas     int64              `json:"connected_slaves"`
}

RedisInfo

type SentinelMasterInfo

type SentinelMasterInfo struct {
	Name      string  `json:"name"`
	Status    string  `json:"status"`
	Address   Address `json:"address"`
	Replicas  int     `json:"slaves"`
	Sentinels int     `json:"sentinels"`
}

Jump to

Keyboard shortcuts

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