Documentation
¶
Overview ¶
Package freecache provides cache driver uses memory to store cache data. Using github.com/coocood/freecache as driver.
Index ¶
- 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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { cache.DriverUtil // contains filtered or unexported fields }
Cache The freecache 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.