beanpoll-cache

cache middleware for beanpoll

npm install beanpoll-cache
2 downloads in the last month

Transports

  • redis
  • memory
  • mongodb

#

Example:

bootstrap.js

var beanie = require('beanie')

beanie.
loader().
params({
    'beanpoll-cache': {
        'memory': {
            'max-entries': 20000    
        },
        'default': {
            'transport': 'redis',
            'ttl': 3600
        }
    }
}).
require('beanpoll-cache').
require('./route.js').
load();

route.js:

exports.plugin = function(router) {


    router.on({

        /**
         * cache users in for default ttl, and using the default transport
         */

        'pull -method=GET users': function() {

        },

        /**
         * clear cache
         */

        'pull -method=POST users': function() {

        },

        /**
         * cache for 1 minute, using in-memory transport
         */

        'pull -method=GET -cache-ttl=60 -cache-trans=memory users/:user': function() {

        },

        /**
         * clear user cache
         */

        'pull -method=POST users/:user': function() {

        },


        /**
         */



    });
}
npm loves you