A redis storage plugin for ha-store.
npm install ha-store-redis
Store
const store = require('ha-store');
const local = require('ha-store/stores/in-memory');
const remote = require('ha-store-redis');
// v4.x.x
const itemStore = store({
resolver: getItems,
cache: {
enabled: true,
tiers: [
{store: local},
{store: remote('my_namespace', '//0.0.0.0:6379')},
],
},
});
// v3.x.x
const itemStore = store({
resolver: getItems,
store: remote('my_namespace', '//0.0.0.0:6379'),
});
It now also supports passing an existing connection object.
const redis = require('redis');
const store = require('ha-store');
const remote = require('ha-store-redis');
const client = redis.createClient('//0.0.0.0:6379');
const itemStore = store({
resolver: getItems,
store: remote('my_namespace', null, client),
});
npm test
This is backwards-compatible with v3.x.x of ha-store.
Please do! This is an open source project - if you see something that you want, open an issue or file a pull request.
If you have a major change, it would be better to open an issue first so that we can talk about it.
I am always looking for more maintainers, as well. Get involved.
Apache 2.0 (c) Frederic Charette