Newer
Older
package cachemdl
import (
"time"
)
const (
// TypeFastCache indicates fast cache as cache storage
TypeFastCache = iota + 1
// TypeRedisCache indicates redis server as cache storage. Use this in grid mode.
TypeRedisCache
)
// Cacher provides access to underlying cache, make sure all caches implement these methods.
//
// The return types of data can be different. Ex. In case of redis cache it is `string`. The caller needs to handle this with the help of Type() method.
//
// Ex.
// (Cacher{}).Type() == TypeRedisCache { // your implementation }
type Cacher interface {
// SET
Set(key string, val interface{})
SetWithExpiration(key string, val interface{}, exp time.Duration)
SetNoExpiration(key string, val interface{})
// GET
Get(key string) (interface{}, bool)
// GetAll() map[string]interface{}
// DELETE
Delete(key string)
// GetItemsCount
GetItemsCount() int