Versions in this module Expand all Collapse all v1 v1.0.1 Nov 9, 2023 v1.0.0 Nov 9, 2023 Changes in this version + const DefaultExpireTime + const PrefixCacheKey + func BuildCacheKey(keyPrefix string, key string) (cacheKey string, err error) + func Decr(key string, step int64) (int64, error) + func Del(keys ...string) error + func Get(key string, val interface{}) error + func GzipDecode(in []byte) ([]byte, error) + func GzipEncode(in []byte) ([]byte, error) + func Incr(key string, step int64) (int64, error) + func Marshal(e Encoding, v interface{}) (data []byte, err error) + func MultiGet(keys []string, valueMap interface{}) error + func MultiSet(valMap map[string]interface{}, expiration time.Duration) error + func Set(key string, val interface{}, expiration time.Duration) error + func Unmarshal(e Encoding, data []byte, v interface{}) (err error) + type Driver interface + Decr func(key string, step int64) (int64, error) + Del func(keys ...string) error + Get func(key string, val interface{}) error + Incr func(key string, step int64) (int64, error) + MultiGet func(keys []string, valueMap interface{}) error + MultiSet func(valMap map[string]interface{}, expiration time.Duration) error + Set func(key string, val interface{}, expiration time.Duration) error + var Client Driver + func NewMemoryCache(keyPrefix string, encoding Encoding) Driver + func NewRedisCache(client *redis.Client, keyPrefix string, encoding Encoding, ...) Driver + type Encoding interface + Marshal func(v interface{}) ([]byte, error) + Unmarshal func(data []byte, v interface{}) error + type GobEncoding struct + func (g GobEncoding) Marshal(v interface{}) ([]byte, error) + func (g GobEncoding) Unmarshal(data []byte, value interface{}) error + type JSONEncoding struct + func (j JSONEncoding) Marshal(v interface{}) ([]byte, error) + func (j JSONEncoding) Unmarshal(data []byte, value interface{}) error + type JSONGzipEncoding struct + func (jz JSONGzipEncoding) Marshal(v interface{}) ([]byte, error) + func (jz JSONGzipEncoding) Unmarshal(data []byte, value interface{}) error + type JSONSnappyEncoding struct + func (s JSONSnappyEncoding) Marshal(v interface{}) (data []byte, err error) + func (s JSONSnappyEncoding) Unmarshal(data []byte, value interface{}) error + type MsgPackEncoding struct + func (mp MsgPackEncoding) Marshal(v interface{}) ([]byte, error) + func (mp MsgPackEncoding) Unmarshal(data []byte, value interface{}) error