Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMiss = errors.New("cache miss")
Functions ¶
This section is empty.
Types ¶
type CodecInterface ¶
type CodecInterface interface { Encode(val interface{}) ([]byte, error) Decode(bts []byte, dest interface{}) error }
CodecInterface 编码接口
func JsonCodec ¶
func JsonCodec() CodecInterface
type DriverInterface ¶
type DriverInterface interface { Get(key string) ([]byte, bool, error) Set(key string, val []byte, ttl time.Duration) error Del(key string) error }
DriverInterface 驱动接口
func MapDriver ¶
func MapDriver() DriverInterface
func NullDriver ¶
func NullDriver() DriverInterface
type Interface ¶
type Interface interface { Has(key string) error Get(key string, dest interface{}) error Set(key string, val interface{}, ttl time.Duration) error Del(key string) error SetOrDel(key string, val interface{}, ttl time.Duration) error GetOrSet(key string, dest interface{}, ttl time.Duration, getter func() (interface{}, error)) error }
Interface 缓存封装
func WithPrefix ¶
Click to show internal directories.
Click to hide internal directories.