redis

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToConnectToRedis    = errors.New("failed to connect to Redis")
	ErrFailedToPingRedis         = errors.New("failed to ping Redis")
	ErrTLSRequestedButNotEnabled = errors.New("TLS requested but not enabled")
	ErrFailedToAppendCACert      = errors.New("failed to append CA cert")
	ErrEmptyCacheID              = errors.New("cache ID cannot be empty")
)

Functions

func NewRedisClient

func NewRedisClient(ctx context.Context, retryOpts helper.RetryOptions, opts RedisClientOptions) (contract.RedisClient, error)

Types

type Blackbox

type Blackbox interface {
	StatusCmdErr(cmd *redis.StatusCmd) error
	ScanIteratorErr(iter *redis.ScanIterator) error
	PipelineDelErr(pipe redis.Pipeliner, ctx context.Context, key string) error
	PipelineExec(pipe redis.Pipeliner, ctx context.Context) error
	StringCmdResult(cmd *redis.StringCmd) (string, error)
	BoolCmdErr(cmd *redis.BoolCmd) (bool, error)
	IntCmdErr(cmd *redis.IntCmd) (int64, error)
}

type Client

type Client interface {
	contract.CacheOperator
}

type ClientOption

type ClientOption func(*ClientOptions)

func WithBatchSize

func WithBatchSize(size int) ClientOption

func WithExpiresAfter

func WithExpiresAfter(d time.Duration) ClientOption

type ClientOptions

type ClientOptions struct {
	ExpiresAfter time.Duration
	BatchSize    int
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type RedisClientOptions

type RedisClientOptions struct {
	C         contract.CertGenerator
	F         contract.FSysFileReader
	FS        fs.ReadFileFS
	Port      int
	Host      string
	Username  string
	Password  string
	CertPath  string
	KeyPath   string
	CAPath    string
	UseTLS    bool
	MutualTLS bool
}

Jump to

Keyboard shortcuts

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