Eric Foster d5378345de connection between front end and database | il y a 6 ans | |
---|---|---|
.. | ||
test | il y a 6 ans | |
.jshintrc | il y a 6 ans | |
.npmignore | il y a 6 ans | |
.testem.json | il y a 6 ans | |
.travis.yml | il y a 6 ans | |
LICENCE | il y a 6 ans | |
README.md | il y a 6 ans | |
index.js | il y a 6 ans | |
package.json | il y a 6 ans |
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