memcache

package
v0.0.0-...-83369f4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package memcache implements a memcache driver for github.com/bradfitz/gomemcache/memcache

Index

Constants

This section is empty.

Variables

View Source
var (
	// Codec is the codec used to marshal/unmarshal interfaces into the byte slices required by the Memcache client
	Codec codec.Codec
)

Functions

This section is empty.

Types

type Memcache

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

Memcache is a struct which implements cache.Cache interface and connects to a Memcache server

func New

func New(servers ...string) *Memcache

New initializes a memcache Client which connects to the given servers

func (*Memcache) Add

func (m *Memcache) Add(key string, val interface{}, exp time.Duration) error

Add writes the given item, if no value already exists for its key. ErrNotStored is returned if that condition is not met.

func (*Memcache) Client

func (m *Memcache) Client() *memcache.Client

Client returns the underlying Memcache client to enable usage of it's more powerful feature-set

func (*Memcache) Decrement

func (m *Memcache) Decrement(key string, delta uint64) error

Decrement decreases the key's value by delta

func (*Memcache) Del

func (m *Memcache) Del(key string) error

Del deletes the given key

func (*Memcache) Exists

func (m *Memcache) Exists(key string) bool

Exists implements the "cache.Cache".Exists() interface

func (*Memcache) Flush

func (m *Memcache) Flush() error

Flush removes all keys from the cache

func (*Memcache) Get

func (m *Memcache) Get(key string, dstVal interface{}) error

Get returns the value for the given key

func (*Memcache) Increment

func (m *Memcache) Increment(key string, delta uint64) error

Increment increases the key's value by delta

func (*Memcache) Replace

func (m *Memcache) Replace(key string, val interface{}, exp time.Duration) error

Replace writes the given item, but only if the server *does* already hold data for this key

func (*Memcache) Set

func (m *Memcache) Set(key string, value interface{}, exp time.Duration) error

Set sets the given key/value pair

func (*Memcache) Touch

func (m *Memcache) Touch(key string, exp time.Duration) error

Touch updates a key's expiration

Jump to

Keyboard shortcuts

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