redis

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package redis provides implementation of Go API for redis interface

Index

Constants

This section is empty.

Variables

View Source
var (
	// Nil is a type alias of redis.Nil.
	Nil = redis.Nil
)

Functions

This section is empty.

Types

type Cmder added in v0.0.51

type Cmder = redis.Cmder

type Conn

type Conn = redis.Conn

Conn is a type alias of redis.Conn.

type Connector added in v0.0.51

type Connector interface {
	Connect(ctx context.Context) (Redis, error)
}

Connector is an interface to connect to Redis servers.

func New

func New(opts ...Option) (c Connector, err error)

New returns Connector if no error occurs.

type Deleter

type Deleter interface {
	Del(keys ...string) *redis.IntCmd
}

type Getter

type Getter interface {
	Get(string) *redis.StringCmd
	MGet(...string) *redis.SliceCmd
}

type Hook added in v0.0.51

type Hook = redis.Hook

type IntCmd

type IntCmd = redis.IntCmd

IntCmd is a type alias of redis.IntCmd.

type Lister

type Lister interface {
}

type Option

type Option func(*redisClient) error

Option represents the functional option for redisClient.

func WithAddrs

func WithAddrs(addrs ...string) Option

WithAddrs returns the option to set the addrs.

func WithClusterSlots

func WithClusterSlots(f func() ([]redis.ClusterSlot, error)) Option

WithClusterSlots returns the option to set the clusterSlots.

func WithDB

func WithDB(db int) Option

WithDB returns the option to set the db.

func WithDialTimeout

func WithDialTimeout(dur string) Option

WithDialTimeout returns the option to set the dialTimeout.

func WithDialer

func WithDialer(der tcp.Dialer) Option

WithDialer returns the option to set the dialer.

func WithDialerFunc added in v0.0.51

func WithDialerFunc(der func(ctx context.Context, addr, port string) (net.Conn, error)) Option

WithDialerFunc returns the option to set the dialer func.

func WithHooks added in v0.0.51

func WithHooks(hooks ...Hook) Option

WithHooks returns the option to add hooks

func WithIdleCheckFrequency

func WithIdleCheckFrequency(dur string) Option

WithIdleCheckFrequency returns the option to set the idleCheckFrequency.

func WithIdleTimeout

func WithIdleTimeout(dur string) Option

WithIdleTimeout returns the option to set the idleTimeout.

func WithInitialPingDuration

func WithInitialPingDuration(dur string) Option

WithInitialPingDuration returns the option to set the initialPingDuration.

func WithInitialPingTimeLimit

func WithInitialPingTimeLimit(lim string) Option

WithInitialPingTimeLimit returns the option to set the initialPingTimeLimit.

func WithKeyPrefix

func WithKeyPrefix(prefix string) Option

WithKeyPrefix returns the option to set the keyPref.

func WithMaximumConnectionAge

func WithMaximumConnectionAge(dur string) Option

WithMaximumConnectionAge returns the option to set the maxConnAge.

func WithMaximumRetryBackoff

func WithMaximumRetryBackoff(dur string) Option

WithMaximumRetryBackoff returns the option to set the maxRetryBackoff.

func WithMinimumIdleConnection

func WithMinimumIdleConnection(minIdleConns int) Option

WithMinimumIdleConnection returns the option to set the minIdleConns.

func WithMinimumRetryBackoff

func WithMinimumRetryBackoff(dur string) Option

WithMinimumRetryBackoff returns the option to set the minRetryBackoff.

func WithOnConnectFunction

func WithOnConnectFunction(f func(*redis.Conn) error) Option

WithOnConnectFunction returns the option to set the onConnect.

func WithOnNewNodeFunction

func WithOnNewNodeFunction(f func(*redis.Client)) Option

WithOnNewNodeFunction returns the option to set the onNewNode.

func WithPassword

func WithPassword(password string) Option

WithPassword returns the option to set the password.

func WithPoolSize

func WithPoolSize(poolSize int) Option

WithPoolSize returns the option to set the poolSize.

func WithPoolTimeout

func WithPoolTimeout(dur string) Option

WithPoolTimeout returns the option to set the poolTimeout.

func WithReadOnlyFlag

func WithReadOnlyFlag(readOnly bool) Option

WithReadOnlyFlag returns the option to set the readOnly.

func WithReadTimeout

func WithReadTimeout(dur string) Option

WithReadTimeout returns the option to set the readTimeout.

func WithRedirectLimit

func WithRedirectLimit(maxRedirects int) Option

WithRedirectLimit returns the option to set the maxRedirects.

func WithRetryLimit

func WithRetryLimit(maxRetries int) Option

WithRetryLimit returns the option to set the maxRetries.

func WithRouteByLatencyFlag

func WithRouteByLatencyFlag(routeByLatency bool) Option

WithRouteByLatencyFlag returns the option to set the routeByLatency.

func WithRouteRandomlyFlag

func WithRouteRandomlyFlag(routeRandomly bool) Option

WithRouteRandomlyFlag returns the option to set the routeRandomly.

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

WithTLSConfig returns the option to set the tlsConfig.

func WithWriteTimeout

func WithWriteTimeout(dur string) Option

WithWriteTimeout returns the option to set the writeTimeout.

type Redis

type Redis interface {
	TxPipeline() redis.Pipeliner
	Ping() *StatusCmd
	Close() error
	Lister
	Getter
	Setter
	Deleter
}

Redis is an interface to communicate with Redis servers.

type Setter

type Setter interface {
}

type StatusCmd

type StatusCmd = redis.StatusCmd

StatusCmd is a type alias of redis.StatusCmd.

type StringCmd

type StringCmd = redis.StringCmd

StringCmd is a type alias of redis.StringCmd.

Jump to

Keyboard shortcuts

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