tree: c1a725c1f107dcb7ea9c5d450749c02c9784e0d4 [path history] [tgz]
  1. test/
  2. .jshintrc
  3. .npmignore
  4. .testem.json
  5. .travis.yml
  6. index.js
  7. LICENCE
  8. package.json
  9. README.md
node_modules/continuable-cache/README.md

continuable-cache

Cache a continuable

Example

var cache = require("continuable-cache")
var fs = require("fs")

var readFile = function (uri) { return function (cb) {
    fs.readFile(uri, cb)
} }

var continuableFile = readFile("./package.json")

var cached = cache(continuableFile)

// will only do one file read operation
cached(function (err, file) {
    /* calls out to fs.readFile */
})

cached(function (err, file) {
    /* get's either err or file from cache in cached */
})

Installation

npm install continuable-cache

Contributors

  • Raynos

MIT Licenced