memcache

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyGotten = errors.New("pipeline error: already gotten")

ErrAlreadyGotten ...

View Source
var ErrConnClosed = errors.New("memcache: connection closed")

ErrConnClosed ...

View Source
var ErrInvalidKeyFormat = errors.New("memcached: invalid key format")

ErrInvalidKeyFormat ...

View Source
var ErrInvalidMDel = ErrBrokenPipe{/* contains filtered or unexported fields */}

ErrInvalidMDel ...

View Source
var ErrInvalidMGet = ErrBrokenPipe{/* contains filtered or unexported fields */}

ErrInvalidMGet ...

View Source
var ErrInvalidMSet = ErrBrokenPipe{/* contains filtered or unexported fields */}

ErrInvalidMSet ...

View Source
var ErrInvalidResponse = ErrBrokenPipe{/* contains filtered or unexported fields */}

ErrInvalidResponse ...

Functions

func NewClientError

func NewClientError(msg string) error

NewClientError ...

func NewServerError

func NewServerError(msg string) error

NewServerError ...

Types

type Client

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

Client ...

func New

func New(addr string, numConns int, options ...Option) (*Client, error)

New ...

func (*Client) Close added in v0.3.0

func (c *Client) Close() error

Close shut down Client

func (*Client) Pipeline

func (c *Client) Pipeline() *Pipeline

Pipeline creates a pipeline

type ErrBrokenPipe

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

ErrBrokenPipe ...

func (ErrBrokenPipe) Error

func (e ErrBrokenPipe) Error() string

type ErrClientError

type ErrClientError struct {
	Message string
}

ErrClientError ...

func (ErrClientError) Error

func (e ErrClientError) Error() string

type ErrServerError

type ErrServerError struct {
	Message string
}

ErrServerError ...

func (ErrServerError) Error

func (e ErrServerError) Error() string

type FlushWriter

type FlushWriter interface {
	io.Writer
	Flush() error
}

FlushWriter ...

func NoopFlusher

func NoopFlusher(w io.Writer) FlushWriter

NoopFlusher ...

type MDelOptions

type MDelOptions struct {
	CAS uint64
	I   bool   // set as stale instead of delete completely
	TTL uint32 // only apply if I = true
}

MDelOptions ...

type MDelResponse

type MDelResponse struct {
	Type MDelResponseType
}

MDelResponse ...

type MDelResponseType

type MDelResponseType int

MDelResponseType ...

const (
	// MDelResponseTypeHD ...
	MDelResponseTypeHD MDelResponseType = iota + 1 // DELETED
	// MDelResponseTypeNF ...
	MDelResponseTypeNF // NOT FOUND
	// MDelResponseTypeEX ...
	MDelResponseTypeEX // EXISTS, cas not match
)

type MGetFlags

type MGetFlags uint64

MGetFlags ...

const (
	// MGetFlagW ...
	MGetFlagW MGetFlags = 1 << iota // won cache lease
	// MGetFlagX ...
	MGetFlagX // stale data
	// MGetFlagZ ...
	MGetFlagZ // already has winning flag
)

type MGetOptions

type MGetOptions struct {
	N   uint32 // option N of mg command
	CAS bool
}

MGetOptions ...

type MGetResponse

type MGetResponse struct {
	Type  MGetResponseType
	Data  []byte
	Flags MGetFlags
	CAS   uint64
}

MGetResponse ...

type MGetResponseType

type MGetResponseType int

MGetResponseType ...

const (
	// MGetResponseTypeVA ...
	MGetResponseTypeVA MGetResponseType = iota + 1
	// MGetResponseTypeHD ...
	MGetResponseTypeHD
	// MGetResponseTypeEN ...
	MGetResponseTypeEN
)

type MSetOptions

type MSetOptions struct {
	CAS uint64
	TTL uint32
}

MSetOptions ...

type MSetResponse

type MSetResponse struct {
	Type MSetResponseType
}

MSetResponse ...

type MSetResponseType

type MSetResponseType int

MSetResponseType ...

const (
	// MSetResponseTypeHD ...
	MSetResponseTypeHD MSetResponseType = iota + 1 // STORED
	// MSetResponseTypeNS ...
	MSetResponseTypeNS // NOT STORED
	// MSetResponseTypeEX ...
	MSetResponseTypeEX // EXISTS, cas modified
	// MSetResponseTypeNF ...
	MSetResponseTypeNF // NOT FOUND, cas not found
)

type Option

type Option func(opts *memcacheOptions)

Option ...

func WithBufferSize added in v0.3.2

func WithBufferSize(size int) Option

WithBufferSize change receiving & sending buffer size

func WithDialErrorLogger added in v0.3.5

func WithDialErrorLogger(fn func(err error)) Option

WithDialErrorLogger set the dial error logger

func WithDialFunc added in v0.4.0

func WithDialFunc(dialFunc func(network, address string) (net.Conn, error)) Option

WithDialFunc ...

func WithRetryDuration

func WithRetryDuration(d time.Duration) Option

WithRetryDuration duration between TCP connection retry

func WithTCPKeepAliveDuration added in v0.3.4

func WithTCPKeepAliveDuration(d time.Duration) Option

WithTCPKeepAliveDuration sets the tcp keep alive duration

type Pipeline

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

Pipeline should NOT be used concurrently

func (*Pipeline) Execute added in v0.3.0

func (p *Pipeline) Execute()

Execute flush operations to memcached (interrupts pipelining)

func (*Pipeline) Finish

func (p *Pipeline) Finish()

Finish ...

func (*Pipeline) FlushAll

func (p *Pipeline) FlushAll() func() error

FlushAll ...

func (*Pipeline) MDel

func (p *Pipeline) MDel(key string, opts MDelOptions) func() (MDelResponse, error)

MDel ...

func (*Pipeline) MGet

func (p *Pipeline) MGet(key string, opts MGetOptions) func() (MGetResponse, error)

MGet ...

func (*Pipeline) MSet

func (p *Pipeline) MSet(key string, value []byte, opts MSetOptions) func() (MSetResponse, error)

MSet ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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