redis

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(props *Properties) (*redis.Client, error)

func NewHealthChecker

func NewHealthChecker(client *redis.Client) actuator.HealthChecker

func NewInformer

func NewInformer(client *redis.Client, props *Properties) actuator.Informer

Types

type HealthChecker

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

func (HealthChecker) Check

func (HealthChecker) Component

func (h HealthChecker) Component() string

type Informer

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

func (Informer) Key

func (d Informer) Key() string

func (Informer) Value

func (d Informer) Value() interface{}

type Properties

type Properties struct {
	Host      string `validate:"required" default:"localhost"`
	Port      int    `validate:"required" default:"6379"`
	Database  int    `default:"0"`
	Username  string
	Password  string
	EnableTLS bool

	// Maximum number of socket connections.
	// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
	PoolSize int `default:"10"`

	// ConnMaxLifetime is the maximum amount of time a connection may be reused.
	//
	// Expired connections may be closed lazily before reuse.
	// If <= 0, connections are not closed due to a connection's age.
	//
	// Default is to not close idle connections.
	ConnMaxLifetime time.Duration `default:"0"`

	// Minimum number of idle connections which is useful when establishing
	// new connection is slow.
	MinIdleConns int `default:"2"`

	// ConnMaxIdleTime is the maximum amount of time a connection may be idle.
	// Should be less than server's timeout.
	//
	// Expired connections may be closed lazily before reuse.
	// If d <= 0, connections are not closed due to a connection's idle time.
	//
	// Default is 30 minutes. -1 disables idle timeout check.
	ConnMaxIdleTime time.Duration `default:"5m"`
}

func NewProperties

func NewProperties(loader config.Loader) (*Properties, error)

func (Properties) Prefix

func (p Properties) Prefix() string

Jump to

Keyboard shortcuts

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