karmia-storage
v0.5.0
Published
Karmia storage module.
Downloads
5
Readme
karmia-storage
Storage module of Karmia JavaScript library
Installation
npm install karmia-storage
Example
const karmia_storage = require('karmia-storage');
Memory
constructor(options)
const storage = new karmia_storage.memory({size: 100000});
Options
- size: Max items of buffer (Default: 10000)
- infinite: if true buffer size set to unlimited (Default: false)
Promise store(key, value)
Store new value.
storage.store(key, value);
Promise count()
Count values in buffer.
storage.count();
Promise has(key)
Check is key exists in buffer.
storage.has(key);
Promise set(key)
Update existing value
storage.set(key, value);
Promise get(key, default_value = undefined)
Get value
// Default value is undefined
storage.get(key);
// Default value is 'default_value'
storage.get(key, 'default_value');