jsondb

package
v2.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	*DB
	// contains filtered or unexported fields
}

Cache is caching jsondb that supports default expiry

func NewCache

func NewCache(db *kvdb.DB, expiry time.Duration) *Cache

NewCache returns a new kvdb wrapper with cache functionality

func (*Cache) Put added in v2.0.12

func (c *Cache) Put(key string, val interface{}, params ...types.StringMap) error

Put adds to the store

func (*Cache) SetExpiry added in v2.0.12

func (c *Cache) SetExpiry(dur time.Duration)

SetExpiry sets the cache expiry

type DB

type DB struct {
	*kvdb.DB
	// contains filtered or unexported fields
}

DB is a simple json object wrapper around a kvdb.DB

func New

func New(db *kvdb.DB) *DB

New returns a new kvdb wrapper

func (*DB) Get added in v2.1.2

func (db *DB) Get(key string, out interface{}, params ...types.Params) error

Get gets a value from the kvdb

func (*DB) GetBool

func (db *DB) GetBool(key string, def ...bool) bool

GetBool returns a bool value

func (*DB) GetDuration

func (db *DB) GetDuration(key string, def ...time.Duration) time.Duration

GetDuration a duration value

func (*DB) GetFloat32 added in v2.0.12

func (db *DB) GetFloat32(key string, def ...float32) float32

GetFloat32 returns an float32 value

func (*DB) GetFloat64 added in v2.0.12

func (db *DB) GetFloat64(key string, def ...float64) float64

GetFloat64 returns an float64 value

func (*DB) GetInt

func (db *DB) GetInt(key string, def ...int) int

GetInt returns an int value

func (*DB) GetInt32

func (db *DB) GetInt32(key string, def ...int32) int32

GetInt32 returns an int32 value

func (*DB) GetInt64

func (db *DB) GetInt64(key string, def ...int64) int64

GetInt64 returns an int64 value

func (*DB) GetString

func (db *DB) GetString(key string, def ...string) string

GetString retruns a string value

func (*DB) OnMiss added in v2.0.12

func (db *DB) OnMiss(handler func(key string, out interface{}, params ...types.Params) error, update bool)

OnMiss provides a json friendly OnMiss handler like kvdb.DB

func (*DB) OnUpdate added in v2.0.16

func (db *DB) OnUpdate(handler func(key string, out interface{}, params ...types.Params) error, passthru bool)

OnUpdate provides a json friendly OnUpdate handler like kvdb.DB

func (*DB) Put added in v2.0.16

func (db *DB) Put(key string, val interface{}, params ...types.StringMap) error

Put override the provider Put

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL