Skip to content

ria-com/node-cacher-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
        }
    }
};

About

Small utils for co-cacher & cacher-promise

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published