Documentation ¶
Index ¶
- func AsClient(client interface{}) *sql.DB
- func New() cache.Cache
- type MysqlCacher
- func (c *MysqlCacher) Client() interface{}
- func (c *MysqlCacher) Close() error
- func (c *MysqlCacher) Codec() encoding.Codec
- func (c *MysqlCacher) Decr(ctx context.Context, key string) error
- func (c *MysqlCacher) Delete(ctx context.Context, key string) error
- func (c *MysqlCacher) Flush(ctx context.Context) error
- func (c *MysqlCacher) Get(ctx context.Context, key string, value interface{}) error
- func (c *MysqlCacher) Incr(ctx context.Context, key string) error
- func (c *MysqlCacher) IsExist(ctx context.Context, key string) (bool, error)
- func (c *MysqlCacher) Put(ctx context.Context, key string, val interface{}, expire int64) error
- func (c *MysqlCacher) SetCodec(codec encoding.Codec)
- func (c *MysqlCacher) StartAndGC(ctx context.Context, opt cache.Options) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MysqlCacher ¶
MysqlCacher represents a mysql cache adapter implementation.
func (*MysqlCacher) Client ¶
func (c *MysqlCacher) Client() interface{}
func (*MysqlCacher) Close ¶
func (c *MysqlCacher) Close() error
func (*MysqlCacher) Codec ¶
func (c *MysqlCacher) Codec() encoding.Codec
func (*MysqlCacher) Decr ¶
func (c *MysqlCacher) Decr(ctx context.Context, key string) error
Decr cached int value.
func (*MysqlCacher) Delete ¶
func (c *MysqlCacher) Delete(ctx context.Context, key string) error
Delete deletes cached value by given key.
func (*MysqlCacher) Flush ¶
func (c *MysqlCacher) Flush(ctx context.Context) error
Flush deletes all cached data.
func (*MysqlCacher) Get ¶
func (c *MysqlCacher) Get(ctx context.Context, key string, value interface{}) error
Get gets cached value by given key.
func (*MysqlCacher) Incr ¶
func (c *MysqlCacher) Incr(ctx context.Context, key string) error
Incr increases cached int-type value by given key as a counter.
func (*MysqlCacher) Put ¶
Put puts value into cache with key and expire time. If expired is 0, it will be deleted by next GC operation.
func (*MysqlCacher) SetCodec ¶
func (c *MysqlCacher) SetCodec(codec encoding.Codec)
func (*MysqlCacher) StartAndGC ¶
StartAndGC starts GC routine based on config string settings.
Click to show internal directories.
Click to hide internal directories.