confredis

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Carry

Types

type Endpoint

type Endpoint struct {
	types.Endpoint[Option]
	// contains filtered or unexported fields
}

func (*Endpoint) Client

func (e *Endpoint) Client() redis.UniversalClient

func (*Endpoint) Close

func (e *Endpoint) Close() error

func (*Endpoint) Init

func (e *Endpoint) Init(ctx context.Context) error

func (*Endpoint) LivenessCheck

func (e *Endpoint) LivenessCheck(ctx context.Context) (d types.LivenessData)

type EndpointClient

type EndpointClient interface {
	Client() redis.UniversalClient
}

func From

func From(ctx context.Context) (EndpointClient, bool)

func Must

func Must(ctx context.Context) EndpointClient

type Option

type Option struct {
	// Prefix
	Prefix string
	// Addresses cluster address
	Addresses []string `url:"-"`
	// DB single-node database to be selected once connected
	DB int `url:""`
	// ConnectionTimeout connection timeout
	ConnectionTimeout types.Duration `url:",default=100ms"`
	// OperationTimeout read/write timeout
	OperationTimeout types.Duration `url:",default=100ms"`

	// BufferSizeKB is the size of the bufio.Reader buffer for each connection.
	// default: 128KiB
	BufferSizeKB int `url:",default=128"`

	// PoolSize controls redis request concurrency. 10*GOMAXPROCS is recommended.
	// this option affects MaxActiveConns, which will be set to 4 times of PoolSize
	// for balancing connection stability and concurrent performance.
	PoolSize          int            `url:",default=20"`
	MaxIdleConnection int            `url:",default=10"`
	MaxIdleTime       types.Duration `url:",default=1h"`

	// SentinelAuth auth info for sentinel if enabled
	SentinelAuth types.Userinfo `url:"-"`
	// MasterName is sentinel master name
	MasterName string

	ClusterMode bool
}

func (Option) ClientOption

func (o Option) ClientOption() *redis.UniversalOptions

func (*Option) SetDefault

func (o *Option) SetDefault()

Jump to

Keyboard shortcuts

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