|
|
пре 5 година | |
|---|---|---|
| .. | ||
| test | пре 5 година | |
| .jshintrc | пре 5 година | |
| .npmignore | пре 5 година | |
| .testem.json | пре 5 година | |
| .travis.yml | пре 5 година | |
| LICENCE | пре 5 година | |
| README.md | пре 5 година | |
| index.js | пре 5 година | |
| package.json | пре 5 година | |
Cache a continuable
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 */
})
npm install continuable-cache