redis

package
v0.0.0-...-4c3da8d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedPool = errors.New("use of closed redis pool")

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr string
	Auth string

	Database int

	LastUse time.Time
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewClient

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

func NewClientNoAuth

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) Do

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

func (*Client) Flush

func (c *Client) Flush() error

func (*Client) Info

func (c *Client) Info() (map[string]string, error)

func (*Client) InfoFull

func (c *Client) InfoFull() (map[string]string, error)

func (*Client) InfoKeySpace

func (c *Client) InfoKeySpace() (map[int]string, error)

func (*Client) MigrateSlot

func (c *Client) MigrateSlot(slot int, target string) (int, error)

func (*Client) MigrateSlotAsync

func (c *Client) MigrateSlotAsync(slot int, target string, option *MigrateSlotAsyncOption) (int, error)

func (*Client) Receive

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

func (*Client) Role

func (c *Client) Role() (string, error)

func (*Client) Select

func (c *Client) Select(database int) error

func (*Client) Send

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

func (*Client) SetMaster

func (c *Client) SetMaster(master string) error

func (*Client) Shutdown

func (c *Client) Shutdown() error

func (*Client) SlotsInfo

func (c *Client) SlotsInfo() (map[int]int, error)

type InfoCache

type InfoCache struct {
	Auth string

	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*InfoCache) Get

func (s *InfoCache) Get(addr string) map[string]string

func (*InfoCache) GetRunId

func (s *InfoCache) GetRunId(addr string) string

type MigrateSlotAsyncOption

type MigrateSlotAsyncOption struct {
	MaxBulks int
	MaxBytes int
	NumKeys  int
	Timeout  time.Duration
}

type MonitorConfig

type MonitorConfig struct {
	Quorum          int
	ParallelSyncs   int
	DownAfter       time.Duration
	FailoverTimeout time.Duration

	NotificationScript   string
	ClientReconfigScript string
}

type Pool

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

func NewPool

func NewPool(auth string, timeout time.Duration) *Pool

func (*Pool) Cleanup

func (p *Pool) Cleanup() error

func (*Pool) Close

func (p *Pool) Close() error

func (*Pool) GetClient

func (p *Pool) GetClient(addr string) (*Client, error)

func (*Pool) Info

func (p *Pool) Info(addr string) (_ map[string]string, err error)

func (*Pool) InfoFull

func (p *Pool) InfoFull(addr string) (_ map[string]string, err error)

func (*Pool) PutClient

func (p *Pool) PutClient(c *Client, err error)

type Sentinel

type Sentinel struct {
	context.Context
	Cancel context.CancelFunc

	Product, Auth string

	LogFunc func(format string, args ...interface{})
	ErrFunc func(err error, format string, args ...interface{})
}

func NewSentinel

func NewSentinel(product, auth string) *Sentinel

func (*Sentinel) FlushConfig

func (s *Sentinel) FlushConfig(sentinel string, timeout time.Duration) error

func (*Sentinel) IsCanceled

func (s *Sentinel) IsCanceled() bool

func (*Sentinel) Masters

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

func (*Sentinel) MastersAndSlaves

func (s *Sentinel) MastersAndSlaves(sentinel string, timeout time.Duration) (map[string]*SentinelGroup, error)

func (*Sentinel) MastersAndSlavesClient

func (s *Sentinel) MastersAndSlavesClient(client *Client) (map[string]*SentinelGroup, error)

func (*Sentinel) MonitorGroups

func (s *Sentinel) MonitorGroups(sentinels []string, timeout time.Duration, config *MonitorConfig, groups map[int]string) error

func (*Sentinel) NodeName

func (s *Sentinel) NodeName(gid int) string

func (*Sentinel) RemoveGroups

func (s *Sentinel) RemoveGroups(sentinels []string, timeout time.Duration, groups map[int]bool) error

func (*Sentinel) RemoveGroupsAll

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

func (*Sentinel) Subscribe

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

type SentinelGroup

type SentinelGroup struct {
	Master map[string]string   `json:"master"`
	Slaves []map[string]string `json:"slaves,omitempty"`
}

type SentinelMaster

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

Jump to

Keyboard shortcuts

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