cacheUtils

package
v0.0.0-...-61472b1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound not found
	ErrNotFound = memcache.ErrNotFound
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Name         string // cacheUtils name, for trace
	Proto        string
	Addr         string
	Active       int // pool
	Idle         int // pool
	DialTimeout  xtime.Duration
	ReadTimeout  xtime.Duration
	WriteTimeout xtime.Duration
	IdleTimeout  xtime.Duration
}

Config client settings.

type Conn

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

Conn represents a connection to a Memcache server.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) Delete

func (c *Conn) Delete(key string) (err error)

Delete sends a command to the server for delete data.

func (*Conn) Err

func (c *Conn) Err() error

Err returns a non-nil value if the connection is broken. The returned

func (*Conn) Get

func (c *Conn) Get(cmd string, cb func(*memcache.Reply), keys ...string) (err error)

Get sends a command to the server for gets data.

func (*Conn) Get2

func (c *Conn) Get2(cmd string, key string) (bs []byte, err error)

Get2 sends a command to the server for gets data.

func (*Conn) Gets

func (c *Conn) Gets(cmd string, keys ...string) (res []*memcache.Reply, err error)

Gets sends a command to the server for gets data.

func (*Conn) IncrDecr

func (c *Conn) IncrDecr(cmd string, key string, delta uint64) (res uint64, err error)

IncrDecr sends a command to the server for incr/decr data.

func (*Conn) Store

func (c *Conn) Store(cmd, key string, value []byte, flags uint32, timeout int32, cas uint64) (err error)

Store sends a command to the server for store data.

func (*Conn) Touch

func (c *Conn) Touch(key string, timeout int32) (err error)

Touch sends a command to the server for touch expire.

type Pool

type Pool struct {
	*memcache.Pool
	// contains filtered or unexported fields
}

Pool cacheUtils conn pool.

func NewPool

func NewPool(c *Config) (p *Pool)

NewPool new a cacheUtils conn pool.

func (*Pool) Close

func (p *Pool) Close() error

Close closes the connection.

func (*Pool) Get

func (p *Pool) Get() *Conn

Get gets a connection. The application must close the returned connection.

Directories

Path Synopsis
gomemcache

Jump to

Keyboard shortcuts

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