Opal-Estate-Pro/node_modules/continuable-cache/README.md
2019-09-13 11:27:52 +07:00

49 lines
1.0 KiB
Markdown

# continuable-cache
<!-- [![build status][1]][2] [![dependency status][3]][4]
[![browser support][5]][6] -->
Cache a continuable
## Example
```js
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
[1]: https://secure.travis-ci.org/Raynos/continuable-cache.png
[2]: http://travis-ci.org/Raynos/continuable-cache
[3]: https://david-dm.org/Raynos/continuable-cache/status.png
[4]: https://david-dm.org/Raynos/continuable-cache
[5]: https://ci.testling.com/Raynos/continuable-cache.png
[6]: https://ci.testling.com/Raynos/continuable-cache