continuable-cache

0.3.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.3.1
    799,804
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.3.1
    799,804
  • 0.2.1
    2
  • 0.1.1
    2

Package Sidebar

Install

npm i continuable-cache

Weekly Downloads

643,826

Version

0.3.1

License

none

Last publish

Collaborators

  • raynos