cache

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsClient

func AsClient(client interface{}) *memcache.Client

func New

func New() cache.Cache

func NewItem

func NewItem(key string, data []byte, expire int32) *memcache.Item

Types

type MemcacheCacher

type MemcacheCacher struct {
	cache.GetAs
	// contains filtered or unexported fields
}

MemcacheCacher represents a memcache cache adapter implementation.

func (*MemcacheCacher) Client

func (c *MemcacheCacher) Client() interface{}

func (*MemcacheCacher) Close

func (c *MemcacheCacher) Close() error

func (*MemcacheCacher) Codec

func (c *MemcacheCacher) Codec() encoding.Codec

func (*MemcacheCacher) Decr

func (c *MemcacheCacher) Decr(ctx context.Context, key string) error

Decr decreases cached int-type value by given key as a counter.

func (*MemcacheCacher) Delete

func (c *MemcacheCacher) Delete(ctx context.Context, key string) error

Delete deletes cached value by given key.

func (*MemcacheCacher) Flush

func (c *MemcacheCacher) Flush(ctx context.Context) error

Flush deletes all cached data.

func (*MemcacheCacher) Get

func (c *MemcacheCacher) Get(ctx context.Context, key string, value interface{}) error

Get gets cached value by given key.

func (*MemcacheCacher) Incr

func (c *MemcacheCacher) Incr(ctx context.Context, key string) error

Incr increases cached int-type value by given key as a counter.

func (*MemcacheCacher) IsExist

func (c *MemcacheCacher) IsExist(ctx context.Context, key string) (bool, error)

IsExist returns true if cached value exists.

func (*MemcacheCacher) Put

func (c *MemcacheCacher) Put(ctx context.Context, key string, val interface{}, expire int64) error

Put puts value into cache with key and expire time. If expired is 0, it lives forever.

func (*MemcacheCacher) SetCodec

func (c *MemcacheCacher) SetCodec(codec encoding.Codec)

func (*MemcacheCacher) StartAndGC

func (c *MemcacheCacher) StartAndGC(ctx context.Context, opt cache.Options) error

StartAndGC starts GC routine based on config string settings. AdapterConfig: 127.0.0.1:9090;127.0.0.1:9091

Jump to

Keyboard shortcuts

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