Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCacheType = errors.New("invalid cache type")
ErrInvalidCacheType is error for invalid cache type.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher interface {
// Get data from cache. The returned value will be
// assigned to param `data`. Param `data` should
// be a pointer just like when using json.Unmarshal.
Get(ctx context.Context, key string, data interface{}) error
// Save data to cache. Set and Get should be using
// the same encoding method. For example, json.Marshal
// for Set and json.Unmarshal for Get.
Set(ctx context.Context, key string, data interface{}, ttl ...time.Duration) error
// Delete data from cache.
Delete(ctx context.Context, key string) error
// Close cache connection.
Close() error
}
Cacher is caching interface.
See usage example in example folder.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bigcache is a wrapper of the original "github.com/allegro/bigcache" library.
|
Package bigcache is a wrapper of the original "github.com/allegro/bigcache" library. |
|
Package memcache is a wrapper of the original "github.com/bradfitz/gomemcache/memcache" library.
|
Package memcache is a wrapper of the original "github.com/bradfitz/gomemcache/memcache" library. |
|
Package mock_cache is a generated GoMock package.
|
Package mock_cache is a generated GoMock package. |
|
Package nocache is a mock of caching.
|
Package nocache is a mock of caching. |
|
Package redis is a wrapper of the original "github.com/go-redis/redis" library.
|
Package redis is a wrapper of the original "github.com/go-redis/redis" library. |
Click to show internal directories.
Click to hide internal directories.