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