Documentation ¶
Index ¶
- func AsClient(client interface{}) *ledis.Ledis
- func New() cache.Cache
- type LedisCacher
- func (c *LedisCacher) Client() interface{}
- func (c *LedisCacher) Close() error
- func (c *LedisCacher) Codec() encoding.Codec
- func (c *LedisCacher) Decr(ctx context.Context, key string) error
- func (c *LedisCacher) Delete(ctx context.Context, key string) (err error)
- func (c *LedisCacher) Flush(ctx context.Context) error
- func (c *LedisCacher) Get(ctx context.Context, key string, value interface{}) error
- func (c *LedisCacher) Incr(ctx context.Context, key string) error
- func (c *LedisCacher) IsExist(ctx context.Context, key string) (bool, error)
- func (c *LedisCacher) Put(ctx context.Context, key string, val interface{}, expire int64) (err error)
- func (c *LedisCacher) SetCodec(codec encoding.Codec)
- func (c *LedisCacher) StartAndGC(ctx context.Context, opts cache.Options) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LedisCacher ¶
LedisCacher represents a ledis cache adapter implementation.
func (*LedisCacher) Client ¶
func (c *LedisCacher) Client() interface{}
func (*LedisCacher) Close ¶
func (c *LedisCacher) Close() error
func (*LedisCacher) Codec ¶
func (c *LedisCacher) Codec() encoding.Codec
func (*LedisCacher) Decr ¶
func (c *LedisCacher) Decr(ctx context.Context, key string) error
Decr decreases cached int-type value by given key as a counter.
func (*LedisCacher) Delete ¶
func (c *LedisCacher) Delete(ctx context.Context, key string) (err error)
Delete deletes cached value by given key.
func (*LedisCacher) Flush ¶
func (c *LedisCacher) Flush(ctx context.Context) error
Flush deletes all cached data.
func (*LedisCacher) Get ¶
func (c *LedisCacher) Get(ctx context.Context, key string, value interface{}) error
Get gets cached value by given key.
func (*LedisCacher) Incr ¶
func (c *LedisCacher) Incr(ctx context.Context, key string) error
Incr increases cached int-type value by given key as a counter.
func (*LedisCacher) Put ¶
func (c *LedisCacher) Put(ctx context.Context, key string, val interface{}, expire int64) (err error)
Put puts value into cache with key and expire time. If expired is 0, it lives forever.
func (*LedisCacher) SetCodec ¶
func (c *LedisCacher) SetCodec(codec encoding.Codec)
func (*LedisCacher) StartAndGC ¶
StartAndGC starts GC routine based on config string settings. AdapterConfig: data_dir=./app.db,db=0
Click to show internal directories.
Click to hide internal directories.