npm

Need private packages and team management tools?Check out npm Orgs. »

cache-manager-pouchdb

0.1.1-beta • Public • Published

Node Cache Manager store for PouchDB

The PouchDB store for the Node Cache Manager Module found on Github and NPM.

Status

Currently the code is in beta. I am using it in an application that was origininally going to use the redis store. Incomplete:

  1. Tests
  2. Code clean up
  3. examples on using remote server
  4. examples on replication
  5. examples of syncing

Installation

npm install cache-manager-pouchdb --save

Usage examples

Here are examples that demonstrate how to implement the PouchDB cache store.

Features

  • Replication
  • Syncing

Single store example

var cacheManager = require('cache-manager');
var pouchDBStore = require('cache-manager-pouchdb');
 
var pouchDBCache = cacheManager.caching({
    store: pouchDBStore,
    options: {
        path: './cache',
        ttl: 600
    }
});
 
var ttl = 60;
pouchDBCache.set('foo', 'bar', {ttl: ttl}, function(err) {
    if (err) { throw err; }
        
    pouchDBCache.get('foo', function(err, result) {
        console.log(result);
        // >> 'bar'
        pouchDBCache.del('foo', function(err) {});
    });
});

Promises example

pouchDBCache.wrap(key, function() {
    return somePromise(key);
})
.then(function(data) {
    console.log('Data:', data);
});

More examples

For more examples please visit the Overview and Usage Examples sections of the Node Cache Manager module

Tests

Tests need to be written.

npm test

Contribution

If you would like to contribute to the project, please fork it and send me a pull request to the dev branch.

License

node-cache-manager-pouchdb is licensed under the MIT license.

Keywords

none

install

npm i cache-manager-pouchdb

Downloadsweekly downloads

3

version

0.1.1-beta

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability