redis

package
v0.0.0-...-12521ac Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr string
	Auth string

	Database int

	LastUse time.Time
	Timeout time.Duration

	Pipeline struct {
		Send, Recv uint64
	}
	// contains filtered or unexported fields
}

Client redis client

func NewClient

func NewClient(addr string, auth string, timeout time.Duration) (*Client, error)

NewClient return a redis client

func NewClientNoAuth

func NewClientNoAuth(addr string, timeout time.Duration) (*Client, error)

NewClientNoAuth return a redis client has not auth

func (*Client) Close

func (c *Client) Close() error

Close close a redis connection

func (*Client) Do

func (c *Client) Do(cmd string, args ...interface{}) (interface{}, error)

Do execute a redis command

func (*Client) Flush

func (c *Client) Flush() error

Flush flush command

func (*Client) Receive

func (c *Client) Receive() (interface{}, error)

Receive receive batch command returns

func (*Client) Send

func (c *Client) Send(cmd string, args ...interface{}) error

Send send a command to redis server

type Sentinel

type Sentinel struct {
	context.Context
	Cancel context.CancelFunc

	MasterName, Auth string
}

Sentinel redis sentinel client

func NewSentinel

func NewSentinel(masterName, auth string) *Sentinel

NewSentinel return a redis sentinel

func (*Sentinel) IsCanceled

func (s *Sentinel) IsCanceled() bool

IsCanceled sentinel is canceled

func (*Sentinel) Master

func (s *Sentinel) Master(sentinels []string, timeout time.Duration) (string, error)

Master get sentinel monitor master address

func (*Sentinel) Subscribe

func (s *Sentinel) Subscribe(sentinels []string, timeout time.Duration, onMajoritySubscribed func()) bool

Subscribe subscribe sentinel

type SentinelMaster

type SentinelMaster struct {
	Addr  string
	Info  map[string]string
	Epoch int64
}

SentinelMaster sentinel master

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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