Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Add(ctx context.Context, i *Item, o ...Option) error
- func (c *Client) CompareAndSwap(ctx context.Context, i *Item, o ...Option) error
- func (c *Client) Dec(ctx context.Context, key string, delta uint64) (uint64, error)
- func (c *Client) Delete(ctx context.Context, key string) error
- func (c *Client) Get(ctx context.Context, key string) (*Item, error)
- func (c *Client) GetMulti(ctx context.Context, keys ...string) (_ map[string]*Item, retErr error)
- func (c *Client) Inc(ctx context.Context, key string, delta uint64, o ...Option) (uint64, error)
- func (c *Client) PurgeNamespace(ctx context.Context, ns string) error
- func (c *Client) Set(ctx context.Context, i *Item, o ...Option) error
- type Item
- type Option
- type Options
- type Value
Constants ¶
View Source
const ( DefaultTimeout = 500 * time.Millisecond DefaultConnMaxLifetime = 30 * time.Minute DefaultMaxIdleConnsPerAddr = 10 )
View Source
const MagicValue = 0x42
Variables ¶
View Source
var ( DefaultKeyHashFunc = func(key string) []byte { return str2byte(key) } XXKeyHashFunc = func(key string) []byte { hash := xxHashPool.Get().(*xxhash.Digest) hash.Reset() hash.WriteString(key) sum := hash.Sum(nil) { xxHashPool.Put(hash) } return sum } )
View Source
var ( ErrCacheMiss = errors.New("memcache: cache miss") ErrNotStored = errors.New("memcache: item not stored") ErrNoServers = errors.New("memcache: no servers configured or available") ErrBadIncrDec = errors.New("memcache: incr or decr on non-numeric value") ErrCASConflict = errors.New("memcache: compare-and-swap conflict") ErrServerError = errors.New("memcache: server error") ErrMalformedKey = errors.New("memcache: key is too long or contains invalid characters") ErrAlreadyExists = errors.New("memcache: item already exists") ErrValueTooLarge = errors.New("memcache: value too large") ErrInvalidArguments = errors.New("memcache: invalid arguments") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CompareAndSwap ¶
type Option ¶
type Option func(c *opts)
func WithExpiration ¶
https://github.com/memcached/memcached/wiki/ProgrammingTricks#scaling-expiration при истечении срока жизни первый зарос получает cache miss, все остальные -- hit, в течении указанного scale
func WithMinUses ¶
func WithNamespace ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.