Documentation ¶
Overview ¶
Package jsondb implements a flat file JSON database engine.
Package jsondb implements a flat file JSON database engine.
Index ¶
- Variables
- func SetDebug(debug bool)
- type DB
- func (db *DB) Commit(document string, v interface{}) error
- func (db *DB) Delete(document string) error
- func (db *DB) DeleteCache(key string) error
- func (db *DB) Exists(document string) bool
- func (db *DB) Get(document string, v interface{}) error
- func (db *DB) GetCache(key string) (string, error)
- func (db *DB) List(path string) ([]string, error)
- func (db *DB) ListAll(path string) ([]string, error)
- func (db *DB) LockCache(key string) bool
- func (db *DB) SetCache(key, value string, expires int) error
- func (db *DB) SetJSONCache(key string, v interface{}, expires int) error
- func (db *DB) UnlockCache(key string)
- func (db *DB) WithCache(cache caches.Cacher) *DB
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CacheTimeout is how long the Redis cache keys live for in seconds, default 2 hours. CacheTimeout = 60 * 60 * 2 CacheLock sync.RWMutex )
View Source
var (
ErrNotFound = errors.New("document not found")
)
Error codes returned.
Functions ¶
Types ¶
type DB ¶
type DB struct { Root string // The root directory of the database Cache caches.Cacher // A cacher for the JSON documents, i.e. Redis }
DB is the database manager.
func (*DB) DeleteCache ¶
DeleteCache deletes a cache key.
func (*DB) SetJSONCache ¶
SetJSONCache caches a JSON object.
func (*DB) UnlockCache ¶
UnlockCache releases the lock on a cache key.
Click to show internal directories.
Click to hide internal directories.