https://github.com/avoidwork/haro-redis
Redis persistent storage adapter for Harō
https://github.com/avoidwork/haro-redis
Last synced: 4 months ago
JSON representation
Redis persistent storage adapter for Harō
- Host: GitHub
- URL: https://github.com/avoidwork/haro-redis
- Owner: avoidwork
- License: bsd-3-clause
- Archived: true
- Created: 2015-07-04T23:07:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-31T11:23:26.000Z (over 10 years ago)
- Last Synced: 2024-12-21T11:38:16.871Z (about 1 year ago)
- Language: JavaScript
- Size: 134 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# haro-redis
[](https://gitter.im/avoidwork/haro-redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://travis-ci.org/avoidwork/haro-redis)
[Harō](http://haro.rocks) is a modern immutable DataStore built with ES6 features, which can be wired to an API for a
complete feedback loop. It is un-opinionated, and offers a plug'n'play solution to modeling, searching, & managing data
on the client, or server (in RAM). It is a [partially persistent data structure](https://en.wikipedia.org/wiki/Persistent_data_structure), by maintaining version sets of records in `versions` ([MVCC](https://en.wikipedia.org/wiki/Multiversion_concurrency_control)).
***haro-redis*** is a persistent storage adapter, providing 'auto saving' behavior, as well as the ability to
`save()`, `load()`, & `unload()` the entire DataStore.
### How to use
Require the adapter & register it with `haro.register(key, fn)`. The key must match the `store.adapters` key. The prefix
will be used if set, otherwise `store.id` will be the prefix for localStorage items. Records will be have keys as `prefix_key`, while
DataStores will be `prefix`.
```javascript
var haro = require('haro'),
store;
// Configure a store to utilize the adapter
store = haro(null, {
adapters: {
redis: {
prefix: "myData",
port: 6379,
host: "127.0.0.1",
config: {}
}
}
});
// Register the adapter
store.register('redis', require('haro-redis'));
// Ready to `load()`, `batch()` or `set()`!
```
## License
Copyright (c) 2015 Jason Mulligan
Licensed under the BSD-3 license