redis

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilConfig = errors.New("redis config cannot be nil")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	URI      string
	Password string
	Database int
}

Config struct

func NewConfig added in v0.7.1

func NewConfig(uri, password string, database int) *Config

NewConfig creates a new Redis config

Parameters:

  • uri: the URI
  • password: the password
  • database: the database

Returns:

*Config: the Redis config

type DefaultHandler added in v0.7.1

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

DefaultHandler struct

func NewDefaultHandler added in v0.7.1

func NewDefaultHandler(config *Config) (
	*DefaultHandler,
	error,
)

NewDefaultHandler creates a new connection

Parameters:

- config *Config: configuration for the connection

Returns:

- *DefaultHandler: connection handler - error: error if the config is nil

func (*DefaultHandler) Client added in v0.7.1

func (d *DefaultHandler) Client() (*redis.Client, error)

Client returns the Redis client

Returns:

- *redis.Client: Redis client - error: error if the connection is not established

func (*DefaultHandler) Connect added in v0.7.1

func (d *DefaultHandler) Connect() (*redis.Client, error)

Connect returns a new Redis client

Returns:

- *redis.Client: Redis client - error: error if the connection fails or is already established

func (*DefaultHandler) Disconnect added in v0.7.1

func (d *DefaultHandler) Disconnect() error

Disconnect closes the Redis client connection

Returns:

- error: error if the disconnection fails

func (*DefaultHandler) IsConnected added in v0.7.5

func (d *DefaultHandler) IsConnected() bool

IsConnected checks if the Redis client is connected

Returns:

- bool: true if connected, false otherwise

type Handler added in v0.7.1

type Handler interface {
	Connect() (*redis.Client, error)
	IsConnected() bool
	Client() (*redis.Client, error)
	Disconnect() error
}

Handler interface

Jump to

Keyboard shortcuts

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