Skip to content

Import path: gitlab.soludian.com/soludian/fountain/libs/cache/memcache

memcache

go
import "gitlab.soludian.com/soludian/fountain/libs/cache/memcache"

Index

Constants

go
const DefaultConfig = `{"conn": "127.0.0.1:11211"}`

go
const KPackageName = "memcache"

func NewMemCache

go
func NewMemCache() cache.Cache

NewMemCache creates a new memcache adapter.

type Cache

Cache Memcache adapter.

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

func (*Cache) ClearAll

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

ClearAll clears all cache in memcache.

func (*Cache) Close

go
func (rc *Cache) Close() error

func (*Cache) Decr

go
func (rc *Cache) Decr(key string) (int64, error)

Decr decreases counter.

func (*Cache) Delete

go
func (rc *Cache) Delete(key string) error

Delete deletes a value in memcache.

func (*Cache) Get

go
func (rc *Cache) Get(key string) ([]byte, error)

Get gets a key's value from memcache.

func (*Cache) GetDefaultConfig

go
func (rc *Cache) GetDefaultConfig() string

func (*Cache) GetMulti

go
func (rc *Cache) GetMulti(keys []string) ([][]byte, error)

GetMulti gets one or keys values from ssdb.

func (*Cache) Has

go
func (rc *Cache) Has(key string) bool

Has checks if a value exists in memcache.

func (*Cache) Incr

go
func (rc *Cache) Incr(key string) (int64, error)

Incr increases counter.

func (*Cache) Peek

go
func (rc *Cache) Peek(key string) (any, error)

Peek get value from memcache. Return a string

func (*Cache) PeekMulti

go
func (rc *Cache) PeekMulti(keys []string) ([]any, error)

PeekMulti gets a value from a key in memcache. Return as string

func (*Cache) Put

go
func (rc *Cache) Put(key string, val any, timeout time.Duration) error

Put puts a value into memcache.

func (*Cache) PutMulti

go
func (rc *Cache) PutMulti(values map[string]any, ttl time.Duration) error

func (*Cache) Reset

go
func (rc *Cache) Reset() error

func (*Cache) Set

go
func (rc *Cache) Set(key string, val []byte, ttl time.Duration) error

func (*Cache) SetMulti

go
func (rc *Cache) SetMulti(values map[string][]byte, ttl time.Duration) error

func (*Cache) SetName

go
func (rc *Cache) SetName(name string)

func (*Cache) StartAndGC

go
func (rc *Cache) StartAndGC(configs ...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 Default config conn is 127.0.0.1:11211

Generated by gomarkdoc