gocache

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGoCache

func NewGoCache() cache.Cache

NewGoCache create new go-cache with default collection name.

Types

type Cache

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

Cache is go-cache adapter.

func (*Cache) ClearAll

func (rc *Cache) ClearAll() error

ClearAll clean all cache in redis. delete this redis collection.

func (*Cache) Decr

func (rc *Cache) Decr(key string) error

Decr decrease counter in go-cache.

func (*Cache) DecrBy

func (rc *Cache) DecrBy(key string) (interface{}, error)

DecrBy decrease counter in go-cache.

func (*Cache) Delete

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

Delete delete cache in go-cache.

func (*Cache) Expire added in v0.0.27

func (rc *Cache) Expire(key string, timeout time.Duration) error

Expire key.

func (*Cache) Get

func (rc *Cache) Get(key string) interface{}

Get cache from go-cache.

func (*Cache) GetMulti

func (rc *Cache) GetMulti(keys []string) []interface{}

GetMulti get cache from go-cache.

func (*Cache) Incr

func (rc *Cache) Incr(key string) error

Incr increase counter in go-cache.

func (*Cache) IncrBy

func (rc *Cache) IncrBy(key string) (interface{}, error)

IncrBy increase counter in go-cache.

func (*Cache) IsExist

func (rc *Cache) IsExist(key string) bool

IsExist check cache's existence in go-cache.

func (*Cache) Put

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

Put put cache to go-cache.

func (*Cache) Set added in v0.0.27

func (rc *Cache) Set(key string, val interface{}) (bool, error)

Set put cache to redis.

func (*Cache) StartAndGC

func (rc *Cache) StartAndGC(config cache.Config) error

StartAndGC start go-cache adapter. the cache item in go-cache are only in memory, so no gc operation.

func (*Cache) TryLock added in v0.0.27

func (rc *Cache) TryLock(key string, val interface{}, timeout time.Duration) error

TryLock ...

func (*Cache) UnLock added in v0.0.27

func (rc *Cache) UnLock(key string, val interface{}) error

UnLock ...

Jump to

Keyboard shortcuts

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