Documentation
¶
Overview ¶
Package mc implements memcached text protocol: https://github.com/memcached/memcached/blob/master/doc/protocol.txt. binary protocol () has not been implemented.
Index ¶
Constants ¶
const ( // ReaderBuffsize is used for bufio reader. ReaderBuffsize = 16 * 1024 // WriterBuffsize is used for bufio writer. WriterBuffsize = 16 * 1024 )
const RealtimeMaxDelta = 60 * 60 * 24 * 30
RealtimeMaxDelta is max delta time.
Variables ¶
var ( RespOK = "OK" RespEnd = "END" RespStored = "STORED" RespNotStored = "NOT_STORED" RespExists = "EXISTS" RespDeleted = "DELETED" RespTouched = "TOUCHED" RespNotFound = "NOT_FOUND" RespErr = "ERROR " RespClientErr = "CLIENT_ERROR " RespServerErr = "SERVER_ERROR " )
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is a function to handle a request and returns a response.
type Request ¶
type Request struct { // Command is memcached command name, see https://github.com/memcached/memcached/wiki/Commands Command string Key string Keys []string Flags string Exptime int64 //in second Data []byte Value int64 Cas string Noreply bool }
Request is a generic memcached request. Some fields are meaningless for some special commands and they are zero values. Exptime will always be 0 or epoch (in seconds)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements memcached server.
func (*Server) RegisterFunc ¶
func (s *Server) RegisterFunc(cmd string, fn HandlerFunc) error
RegisterFunc registers a handler to handle this command.
func (*Server) Serve ¶
Serve accepts incoming connections on the Listener ln, creating a new service goroutine for each. The service goroutines read requests and then call registered handlers to reply to them.