redis

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package redis provides Redis client helpers. Package redis 提供 Redis 客户端辅助。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg Config) (*redis.Client, error)

NewClient creates a Redis client. NewClient 创建 Redis 客户端。

Example / 示例:

client, _ := redis.NewClient(redis.Config{Addr: "localhost:6379"})

func Ping

func Ping(ctx context.Context, client *redis.Client) error

Ping checks Redis connectivity. Ping 检查 Redis 连通性。

Types

type Config

type Config struct {
	Addr         string
	Username     string
	Password     string
	DB           int
	PoolSize     int
	MinIdleConns int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Config holds Redis client settings. Config 包含 Redis 客户端配置。

Jump to

Keyboard shortcuts

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