Documentation
¶
Index ¶
- type Data
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) Del(key string) error
- func (d *Driver) DelCounter(key string) error
- func (d *Driver) Expire(key string, ttl time.Duration) error
- func (d *Driver) ExpireCounter(key string, ttl time.Duration) error
- func (d *Driver) Flush() error
- func (d *Driver) GetBytesValue(key string) ([]byte, error)
- func (d *Driver) GetCounter(key string) (int64, error)
- func (d *Driver) IncrCounter(key string, increment int64, ttl time.Duration) (int64, error)
- func (d *Driver) MGetBytesValue(keys ...string) (map[string][]byte, error)
- func (d *Driver) MSetBytesValue(data map[string][]byte, ttl time.Duration) error
- func (d *Driver) SetBytesValue(key string, bytes []byte, ttl time.Duration) error
- func (d *Driver) SetCounter(key string, v int64, ttl time.Duration) error
- func (d *Driver) SetGCErrHandler(f func(err error))
- func (d *Driver) UpdateBytesValue(key string, bytes []byte, ttl time.Duration) error
- type Hashed
- type Status
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct { cache.DriverUtil Store Store GcErrHanlder func(err error) }
Driver driver struct
func (*Driver) DelCounter ¶
DelCounter Delete int val in cache by given key.Count cache and data cache are in two independent namespace.
func (*Driver) ExpireCounter ¶
ExpireCounter set int item ttl by given key and ttl.
func (*Driver) GetBytesValue ¶
GetBytesValue Get bytes data from cache by given key.
func (*Driver) GetCounter ¶
GetCounter Get int val from cache by given key.Count cache and data cache are in two independent namespace.
func (*Driver) IncrCounter ¶
IncrCounter Increase int val in cache by given key.Count cache and data cache are in two independent namespace.
func (*Driver) MGetBytesValue ¶
MGetBytesValue get multiple bytes data from cache by given keys. Return data bytes map and any error if raised.
func (*Driver) MSetBytesValue ¶
MSetBytesValue set multiple bytes data to cache with given key-value map. Return any error if raised.
func (*Driver) SetBytesValue ¶
SetBytesValue Set bytes data to cache by given key.
func (*Driver) SetCounter ¶
SetCounter Set int val in cache by given key.Count cache and data cache are in two independent namespace.
func (*Driver) SetGCErrHandler ¶
SetGCErrHandler Set callback to handler error raised when gc.
type Store ¶
type Store interface { //Close close cache store. //Return any error if raised. Close() error //Flush flush cache. //Return any error if raised. Flush() error //Hash hash given key to hashed string. //Return hash and any error if raised Hash(string) (string, error) //Lock lock by given hashed key. //Return unlock func and any error if raised Lock(string) (func(), error) //Load load hash data by given hash key. //Return hash data and any error if raised. Load(hash string) (*Hashed, error) //Delete delete all data by given hash key. //Return any error if raised. Delete(hash string) error //Save save hash data by given hash key,status and hash data. //Return any error if raised. Save(hash string, status *Status, data *Hashed) error }
Store cache store interface