redis2

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

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

Go to latest
Published: Nov 17, 2017 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 {
	sync.Mutex
	// contains filtered or unexported fields
}

Client is the thread that connect to the remote redis server

func NewClient

func NewClient(c *lib.RelayerConfig) *Client

NewClient creates a new client that connect to a Redis server

func (*Client) Exit

func (clt *Client) Exit()

Exit closes the connection and destroy all the client resources

func (*Client) IsValid

func (clt *Client) IsValid() bool

IsValid is used for pool management, it ignores disconnect clients

func (*Client) Reload

func (clt *Client) Reload(c *lib.RelayerConfig)

Reload initialize teh configuration

type CreateFunction

type CreateFunction func(*lib.RelayerConfig) *Client

type Pool

type Pool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Pool keep a list of clients' elements

func NewPool

func NewPool(cfg *lib.RelayerConfig) (p *Pool)

New returns a new pool manager

func (*Pool) Get

func (p *Pool) Get() (c *Client)

Get return a client from the pool or creates a new one

func (*Pool) Put

func (p *Pool) Put(c *Client)

Put stores a client in the idle pool if still valid

func (*Pool) ReadConfig

func (p *Pool) ReadConfig(cfg *lib.RelayerConfig)

func (*Pool) Reset

func (p *Pool) Reset()

type Server

type Server struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Server is the thread that listen for clients' connections

func New

func New(c lib.RelayerConfig, done chan bool) (*Server, error)

New creates a new Redis local server

func (*Server) Exit

func (srv *Server) Exit()

Exit closes the listener and send done to main

func (*Server) Reload

func (srv *Server) Reload(c *lib.RelayerConfig) error

Reload the configuration

func (*Server) Start

func (srv *Server) Start() (e error)

Start accepts incoming connections on the Listener

Jump to

Keyboard shortcuts

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