Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jtblin/node-sync-redis-store
A synchronous Fibers-powered redis store for SyncCache module
https://github.com/jtblin/node-sync-redis-store
Last synced: 19 days ago
JSON representation
A synchronous Fibers-powered redis store for SyncCache module
- Host: GitHub
- URL: https://github.com/jtblin/node-sync-redis-store
- Owner: jtblin
- License: other
- Created: 2015-05-22T09:24:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-22T09:27:14.000Z (over 9 years ago)
- Last Synced: 2024-10-28T09:07:04.219Z (2 months ago)
- Language: JavaScript
- Size: 97.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sync-redis-store
Synchronous Fibers-powered Redis store for [sync-cache](https://github.com/jtblin/sync-cache).
The store use [syncho](https://github.com/jtblin/syncho) to retrieve data "synchronously" from memcached
so the code needs to run in a Fiber.## Usage
npm install sync-redis-store --save
```js
var Sync = require('syncho')
, SyncCache = require('sync-cache')
, RedisStore = require('sync-redis-store')
, store = new RedisStore({ host: 'my-redis.com', maxAge: 1000*60*60, ns: 'mynamespace' })
, cache = new SyncCache({ store: store, load: mySyncFunction })
;Sync(function () {
console.log(cache.get('some-key'));
});function mySyncFunction () {
return 'some value';
}
```### Parameters
- `options` - an options object
### Options
- `host` - redis endpoint
- `port` - redis port
- `auth` - redis auth secret
- `ns` - optional namespace
- `maxAge` - maximum number of milliseconds to keep items, defaults **60000**
- `separator` - separator for namespace (default `/`)## Testing
`npm test`
# License
BSD