cacher-utils

0.1.3 • Public • Published

node-cacher-utils

Part of co-cacher & cacher-promise

example

var utils = require('./'),
    co = require('co'),
    storage = utils.getCacheStorage();


co(function *(){
    var result = yield storage.set("test",260,60);
    var result = yield storage.get("test");
    console.log(result);
}).catch(onerror);

function onerror(err) { console.error(err.stack); }

adapters

  • memcached
  • redis

config

module.exports = {
    // https://github.com/3rd-Eden/node-memcached
    memcached: {
        servers: 'localhost:11211', // You can either use: String, Array, Object
        options: {
            poolSize: 20
        }
    },
    // https://github.com/mjackson/then-redis
    redis: {
        url: 'tcp://localhost:6379'
    },
    cache: {
        expires: 120, // Default cache expires in seconds
        storage: 'memcached',
        key: {
            prefix: 'cw_',
            crc32: false
        }
    }
};

Readme

Keywords

none

Package Sidebar

Install

npm i cacher-utils

Weekly Downloads

490

Version

0.1.3

License

none

Last publish

Collaborators

  • apelsyn