Documentation ¶
Index ¶
- Variables
- func AsClient(client interface{}) *nodb.Nodb
- func New() cache.Cache
- type NodbCacher
- func (c *NodbCacher) Client() interface{}
- func (c *NodbCacher) Close() error
- func (c *NodbCacher) Codec() encoding.Codec
- func (c *NodbCacher) Decr(ctx context.Context, key string) error
- func (c *NodbCacher) Delete(ctx context.Context, key string) error
- func (c *NodbCacher) Flush(ctx context.Context) (err error)
- func (c *NodbCacher) Get(ctx context.Context, key string, value interface{}) error
- func (c *NodbCacher) Incr(ctx context.Context, key string) error
- func (c *NodbCacher) IsExist(ctx context.Context, key string) (bool, error)
- func (c *NodbCacher) Put(ctx context.Context, key string, val interface{}, expire int64) (err error)
- func (c *NodbCacher) SetCodec(codec encoding.Codec)
- func (c *NodbCacher) StartAndGC(ctx context.Context, opt cache.Options) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDBExists = errors.New("database already exists")
)
Functions ¶
Types ¶
type NodbCacher ¶
NodbCacher represents a nodb cache adapter implementation.
func (*NodbCacher) Client ¶
func (c *NodbCacher) Client() interface{}
func (*NodbCacher) Close ¶
func (c *NodbCacher) Close() error
func (*NodbCacher) Codec ¶
func (c *NodbCacher) Codec() encoding.Codec
func (*NodbCacher) Decr ¶
func (c *NodbCacher) Decr(ctx context.Context, key string) error
Decr decreases cached int-type value by given key as a counter.
func (*NodbCacher) Delete ¶
func (c *NodbCacher) Delete(ctx context.Context, key string) error
Delete deletes cached value by given key.
func (*NodbCacher) Flush ¶
func (c *NodbCacher) Flush(ctx context.Context) (err error)
Flush deletes all cached data.
func (*NodbCacher) Get ¶
func (c *NodbCacher) Get(ctx context.Context, key string, value interface{}) error
Get gets cached value by given key.
func (*NodbCacher) Incr ¶
func (c *NodbCacher) Incr(ctx context.Context, key string) error
Incr increases cached int-type value by given key as a counter.
func (*NodbCacher) Put ¶
func (c *NodbCacher) 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 (*NodbCacher) SetCodec ¶
func (c *NodbCacher) SetCodec(codec encoding.Codec)
func (*NodbCacher) StartAndGC ¶
StartAndGC starts GC routine based on config string settings.
Click to show internal directories.
Click to hide internal directories.