memcache

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ERROR means the client sent a nonexistent command name.
	ErrError = errs.New("ERROR")

	// CLIENT_ERROR
	// means some sort of client error in the input line, i.e. the input
	// doesn't conform to the protocol in some way. <error> is a
	// human-readable error string.
	ErrBadRequest = errs.New("CLIENT_ERROR bad request")
	ErrBadKey     = errs.New("CLIENT_ERROR key invalid")
	ErrBadFlags   = errs.New("CLIENT_ERROR flags is not a valid integer")
	ErrBadExptime = errs.New("CLIENT_ERROR exptime is not a valid integer")
	ErrBadLength  = errs.New("CLIENT_ERROR length is not a valid integer")
	ErrBadCas     = errs.New("CLIENT_ERROR cas is not a valid integer")

	// SERVER_ERROR
	// means some sort of server error prevents the server from carrying
	// out the command. <error> is a human-readable error string. In cases
	// of severe server errors, which make it impossible to continue
	// serving the client (this shouldn't normally happen), the server will
	// close the connection after sending the error line. This is the only
	// case in which the server closes a connection to a client.
	ErrClosed      = errs.New("SERVER_ERROR connection closed")
	ErrPingerPong  = errs.New("SERVER_ERROR Pinger pong unexpected")
	ErrAssertReq   = errs.New("SERVER_ERROR assert request not ok")
	ErrBadResponse = errs.New("SERVER_ERROR bad response")
)

errors

Functions

func NewNodeConn

func NewNodeConn(cluster, addr string, dialTimeout, readTimeout, writeTimeout time.Duration) (nc proto.NodeConn)

NewNodeConn returns node conn.

func NewPinger added in v1.3.2

func NewPinger(nc *libnet.Conn) proto.Pinger

NewPinger new pinger.

func NewProxyConn

func NewProxyConn(rw *libnet.Conn) proto.ProxyConn

NewProxyConn new a memcache decoder and encode.

Types

type MCRequest

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

MCRequest is the mc client Msg type and data. Storage commands:

	<command name> <key> <flags> <exptime> <bytes> [noreply]\r\n
 cas <key> <flags> <exptime> <bytes> <cas unique> [noreply]\r\n

Retrieval commands:

get|gets <key>*\r\n

Deletion command:

delete <key> [noreply]\r\n

Increment/Decrement:

incr|decr <key> <value> [noreply]\r\n

Touch:

touch <key> <exptime> [noreply]\r\n

Get And Touch:

gat|gats <exptime> <key>*\r\n

func GetReq

func GetReq() *MCRequest

GetReq get the msg from pool

func NewReq

func NewReq() *MCRequest

NewReq return new mc req.

func (*MCRequest) Cmd

func (r *MCRequest) Cmd() []byte

Cmd get Msg cmd.

func (*MCRequest) CmdString

func (r *MCRequest) CmdString() string

CmdString will return string of cmd for prom report

func (*MCRequest) Key

func (r *MCRequest) Key() []byte

Key get Msg key.

func (*MCRequest) Put

func (r *MCRequest) Put()

Put put req back to pool.

func (*MCRequest) String

func (r *MCRequest) String() string

type RequestType

type RequestType byte

RequestType is the protocol-agnostic identifier for the command

const (
	RequestTypeUnknown RequestType = iota
	RequestTypeSet
	RequestTypeAdd
	RequestTypeReplace
	RequestTypeAppend
	RequestTypePrepend
	RequestTypeCas
	RequestTypeGet
	RequestTypeGets
	RequestTypeDelete
	RequestTypeIncr
	RequestTypeDecr
	RequestTypeTouch
	RequestTypeGat
	RequestTypeGats
)

all memcache Msg type

func (RequestType) Bytes

func (rt RequestType) Bytes() []byte

Bytes get reqtype bytes.

func (RequestType) String

func (rt RequestType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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