Documentation
¶
Index ¶
- Constants
- Variables
- type Cache
- func (c *Cache) Close() error
- func (c *Cache) Del(key string) error
- func (c *Cache) DelCounter(key string) error
- func (c *Cache) Expire(key string, ttl time.Duration) error
- func (c *Cache) ExpireCounter(key string, ttl time.Duration) error
- func (c *Cache) Flush() error
- func (c *Cache) GetBytesValue(key string) ([]byte, error)
- func (c *Cache) GetCounter(key string) (int64, error)
- func (c *Cache) IncrCounter(key string, increment int64, ttl time.Duration) (int64, error)
- func (c *Cache) MGetBytesValue(keys ...string) (map[string][]byte, error)
- func (c *Cache) MSetBytesValue(data map[string][]byte, ttl time.Duration) error
- func (c *Cache) SetBytesValue(key string, bytes []byte, ttl time.Duration) error
- func (c *Cache) SetCounter(key string, v int64, ttl time.Duration) error
- func (c *Cache) SetGCErrHandler(f func(err error))
- func (c *Cache) UpdateBytesValue(key string, bytes []byte, ttl time.Duration) error
- type Config
Constants ¶
const VersionMinLength = 256
const VersionTypeKey = byte(1)
const VersionTypeValue = byte(2)
Variables ¶
var ErrVersionFormatWrong = errors.New("error version format wrong")
ErrVersionFormatWrong raised when version format wrong
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache The redis cache Driver.
func (*Cache) DelCounter ¶
DelCounter Delete int val in cache by given key.Count cache and data cache are in two independent namespace. Return any error raised.
func (*Cache) ExpireCounter ¶
ExpireCounter set cache counter expire duration by given key and ttl
func (*Cache) GetBytesValue ¶
GetBytesValue Get bytes data from cache by given key. Return data bytes and any error raised.
func (*Cache) GetCounter ¶
GetCounter Get int val from cache by given key.Count cache and data cache are in two independent namespace. Return int data value and any error raised.
func (*Cache) IncrCounter ¶
IncrCounter Increase int val in cache by given key.Count cache and data cache are in two independent namespace. Return int data value and any error raised.
func (*Cache) MGetBytesValue ¶
MGetBytesValue get multiple bytes data from cache by given keys. Return data bytes map and any error if raised.
func (*Cache) MSetBytesValue ¶
MSetBytesValue set multiple bytes data to cache with given key-value map. Return any error if raised.
func (*Cache) SetBytesValue ¶
SetBytesValue Set bytes data to cache by given key. Return any error raised.
func (*Cache) SetCounter ¶
SetCounter Set int val in cache by given key.Count cache and data cache are in two independent namespace. Return any error raised.
func (*Cache) SetGCErrHandler ¶
SetGCErrHandler Set callback to handler error raised when gc.
type Config ¶
type Config struct { Local cache.OptionConfig Remote cache.OptionConfig }
Config Cache driver config.