co-cacheable
co wrapper for cacheable
Last updated 2 years ago by ktmud .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install co-cacheable 
SYNC missed versions from official npm registry.

co-cacheable

Enable you to wrap generator function with cacheable

Usage

var cached = require('co-cacheable')({
    client: new RedisClient()
    prefix: 'cacheable'
})

function User() {
}

User.prototype.getDetails = function* getDetails() {
  // fetch from a remote API
}

User.prototype.thunkedMethod = function() {
  return function(callback) {
  }
}
// manually mark this function as thunked method
User.prototype.thunkedMethod.isThunk = true

cached.register(User)
User.enableCache('.getDetails')
User.enableCache('.thunkedMethod')
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |