wildcard-store
A JavaScript store with glob-like patterns best suitable for event emitters. Supports one- and two-star wildcards both in keys and when finding records.
Installation
npm install --save wildcard-store
API
set(key, value, [uses])
Saves the value to the internal storage. The third parameter limits the number of times the value can be retrieved.
get(pattern)
Returns an array of values whose kes matches the provided pattern.
del(key, [value])
Removes values whose key exactly matches the provided one. If a value is provided, deletes only records that are equal to it.
Usage
let Store = require('wildcard-store');
let store = new Store({
delimeter: '.',
prefix: '~'
});
store.set('app.user.created', 'foo');
store.set('app.model.created', 'bar', 1);
store.get('app.user.created')
store.get('app.**');
store.get('app.*');
store.get('orm.model.created');