redis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, plugins ...Plugin) (*redis.Client, error)

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, o *Options, plugins ...Plugin) (client *redis.Client, err error)

func NewClusterClient

func NewClusterClient(ctx context.Context, plugins ...clusterExt) (*redis.ClusterClient, error)

func NewClusterClientWithOptions

func NewClusterClientWithOptions(ctx context.Context, o *Options, plugins ...clusterExt) (client *redis.ClusterClient, err error)

Types

type ClientOptions

type ClientOptions struct {
	Addr    string
	Network string
	DB      int `config:"db"`
}

type ClusterOptions

type ClusterOptions struct {
	Addrs          []string
	MaxRedirects   int  `config:"maxredirects"`
	ReadOnly       bool `config:"readonly"`
	RouteByLatency bool `config:"routebylatency"`
	RouteRandomly  bool `config:"routerandomly"`
}

type Options

type Options struct {
	Sentinel           SentinelOptions
	Password           string
	MaxRetries         int
	MinRetryBackoff    time.Duration
	MaxRetryBackoff    time.Duration
	DialTimeout        time.Duration
	ReadTimeout        time.Duration
	WriteTimeout       time.Duration
	PoolSize           int
	MinIdleConns       int
	MaxConnAge         time.Duration
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
	Client             ClientOptions
	Cluster            ClusterOptions
}

func NewOptions

func NewOptions() (*Options, error)

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

type Plugin

type Plugin func(context.Context, *redis.Client) error

type SentinelOptions

type SentinelOptions struct {
	MasterName string `config:"masterName"`
	Addrs      []string
	Password   string
}

Directories

Path Synopsis
examples
plugins

Jump to

Keyboard shortcuts

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