redis

package
v0.0.0-20260608 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the go-redis/v9 UniversalClient.

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a new Redis client instance.

func (*Client) Del

func (c *Client) Del(ctx context.Context, keys ...string) error

Del deletes one or more keys.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (string, error)

Get retrieves a value by key.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping pings the Redis server.

func (*Client) RawClient

func (c *Client) RawClient() redis.UniversalClient

RawClient returns the underlying universal client for advanced usage.

func (*Client) Set

func (c *Client) Set(ctx context.Context, key string, value any, expiration time.Duration) error

Set stores a value by key with an optional expiration.

type Config

type Config struct {
	Host     string
	Port     int
	Password string
	DB       int
}

Config represents the Redis connection configuration.

Jump to

Keyboard shortcuts

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