Snow 1d0b9c5323 增加了node环境 | hai 1 mes | |
---|---|---|
.. | ||
test | hai 1 mes | |
.jshintrc | hai 1 mes | |
.npmignore | hai 1 mes | |
.testem.json | hai 1 mes | |
.travis.yml | hai 1 mes | |
LICENCE | hai 1 mes | |
README.md | hai 1 mes | |
index.js | hai 1 mes | |
package.json | hai 1 mes |
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