Import path:
gitlab.soludian.com/soludian/fountain/libs/cache/memcache
memcache
go
import "gitlab.soludian.com/soludian/fountain/libs/cache/memcache"Index
- Constants
- func NewMemCache() cache.Cache
- type Cache
- func (rc *Cache) ClearAll(context.Context) error
- func (rc *Cache) Close() error
- func (rc *Cache) Decr(key string) (int64, error)
- func (rc *Cache) Delete(key string) error
- func (rc *Cache) Get(key string) ([]byte, error)
- func (rc *Cache) GetDefaultConfig() string
- func (rc *Cache) GetMulti(keys []string) ([][]byte, error)
- func (rc *Cache) Has(key string) bool
- func (rc *Cache) Incr(key string) (int64, error)
- func (rc *Cache) Peek(key string) (any, error)
- func (rc *Cache) PeekMulti(keys []string) ([]any, error)
- func (rc *Cache) Put(key string, val any, timeout time.Duration) error
- func (rc *Cache) PutMulti(values map[string]any, ttl time.Duration) error
- func (rc *Cache) Reset() error
- func (rc *Cache) Set(key string, val []byte, ttl time.Duration) error
- func (rc *Cache) SetMulti(values map[string][]byte, ttl time.Duration) error
- func (rc *Cache) SetName(name string)
- func (rc *Cache) StartAndGC(configs ...string) error
Constants
go
const DefaultConfig = `{"conn": "127.0.0.1:11211"}`go
const KPackageName = "memcache"func NewMemCache
go
func NewMemCache() cache.CacheNewMemCache 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) errorClearAll clears all cache in memcache.
func (*Cache) Close
go
func (rc *Cache) Close() errorfunc (*Cache) Decr
go
func (rc *Cache) Decr(key string) (int64, error)Decr decreases counter.
func (*Cache) Delete
go
func (rc *Cache) Delete(key string) errorDelete 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() stringfunc (*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) boolHas 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) errorPut puts a value into memcache.
func (*Cache) PutMulti
go
func (rc *Cache) PutMulti(values map[string]any, ttl time.Duration) errorfunc (*Cache) Reset
go
func (rc *Cache) Reset() errorfunc (*Cache) Set
go
func (rc *Cache) Set(key string, val []byte, ttl time.Duration) errorfunc (*Cache) SetMulti
go
func (rc *Cache) SetMulti(values map[string][]byte, ttl time.Duration) errorfunc (*Cache) SetName
go
func (rc *Cache) SetName(name string)func (*Cache) StartAndGC
go
func (rc *Cache) StartAndGC(configs ...string) errorStartAndGC 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