Documentation ¶
Index ¶
- func AsClient(client interface{}) *redis.Client
- func New() cache.Cache
- type RedisCacher
- func (c *RedisCacher) Client() interface{}
- func (c *RedisCacher) Close() error
- func (c *RedisCacher) Codec() encoding.Codec
- func (c *RedisCacher) Decr(ctx context.Context, key string) error
- func (c *RedisCacher) Delete(ctx context.Context, key string) error
- func (c *RedisCacher) Flush(ctx context.Context) error
- func (c *RedisCacher) Get(ctx context.Context, key string, value interface{}) error
- func (c *RedisCacher) Incr(ctx context.Context, key string) error
- func (c *RedisCacher) IsExist(ctx context.Context, key string) (bool, error)
- func (c *RedisCacher) Name() string
- func (c *RedisCacher) Options() *redis.Options
- func (c *RedisCacher) Put(ctx context.Context, key string, val interface{}, expire int64) error
- func (c *RedisCacher) SetCodec(codec encoding.Codec)
- func (c *RedisCacher) StartAndGC(ctx context.Context, opts cache.Options) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RedisCacher ¶
RedisCacher represents a redis cache adapter implementation.
func (*RedisCacher) Client ¶
func (c *RedisCacher) Client() interface{}
func (*RedisCacher) Close ¶
func (c *RedisCacher) Close() error
func (*RedisCacher) Codec ¶
func (c *RedisCacher) Codec() encoding.Codec
func (*RedisCacher) Decr ¶
func (c *RedisCacher) Decr(ctx context.Context, key string) error
Decr decreases cached int-type value by given key as a counter.
func (*RedisCacher) Delete ¶
func (c *RedisCacher) Delete(ctx context.Context, key string) error
Delete deletes cached value by given key.
func (*RedisCacher) Flush ¶
func (c *RedisCacher) Flush(ctx context.Context) error
Flush deletes all cached data.
func (*RedisCacher) Get ¶
func (c *RedisCacher) Get(ctx context.Context, key string, value interface{}) error
Get gets cached value by given key.
func (*RedisCacher) Incr ¶
func (c *RedisCacher) Incr(ctx context.Context, key string) error
Incr increases cached int-type value by given key as a counter.
func (*RedisCacher) Name ¶ added in v0.7.2
func (c *RedisCacher) Name() string
func (*RedisCacher) Options ¶
func (c *RedisCacher) Options() *redis.Options
func (*RedisCacher) Put ¶
Put puts value into cache with key and expire time. If expired is 0, it lives forever.
func (*RedisCacher) SetCodec ¶
func (c *RedisCacher) SetCodec(codec encoding.Codec)
func (*RedisCacher) StartAndGC ¶
StartAndGC starts GC routine based on config string settings. AdapterConfig: network=tcp,addr=:6379,password=123456,db=0,pool_size=100,idle_timeout=180,hset_name=Cache,prefix=cache:
Click to show internal directories.
Click to hide internal directories.