memcache

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

depend on github.com/bradfitz/gomemcache/memcache

go install github.com/bradfitz/gomemcache/memcache

Usage: import(

_ "github.com/bhojpur/web/cache/memcache"
"github.com/bhojpur/web/cache"

)

bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemCache

func NewMemCache() cache.Cache

NewMemCache creates a new memcache adapter.

Types

type Cache

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

Cache Memcache adapter.

func (*Cache) ClearAll

func (rc *Cache) ClearAll(context.Context) error

ClearAll clears all cache in memcache.

func (*Cache) Decr

func (rc *Cache) Decr(ctx context.Context, key string) error

Decr decreases counter.

func (*Cache) Delete

func (rc *Cache) Delete(ctx context.Context, key string) error

Delete deletes a value in memcache.

func (*Cache) Get

func (rc *Cache) Get(ctx context.Context, key string) (interface{}, error)

Get get value from memcache.

func (*Cache) GetMulti

func (rc *Cache) GetMulti(ctx context.Context, keys []string) ([]interface{}, error)

GetMulti gets a value from a key in memcache.

func (*Cache) Incr

func (rc *Cache) Incr(ctx context.Context, key string) error

Incr increases counter.

func (*Cache) IsExist

func (rc *Cache) IsExist(ctx context.Context, key string) (bool, error)

IsExist checks if a value exists in memcache.

func (*Cache) Put

func (rc *Cache) Put(ctx context.Context, key string, val interface{}, timeout time.Duration) error

Put puts a value into memcache.

func (*Cache) StartAndGC

func (rc *Cache) StartAndGC(config string) error

StartAndGC starts the memcache adapter. config: must be in the format {"conn":"connection info"}. If an error occurs during connecting, an error is returned

Jump to

Keyboard shortcuts

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