Package Exports
- popsicle-cache
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (popsicle-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Popsicle Cache
Override the Popsicle transport mechanism with HTTP caching.
Installation
npm install popsicle-cache --save
Usage
var popsicle = require('popsicle')
var cache = require('popsicle-cache')
popsicle('http://example.com')
.use(cache())
.then(function (res) {
console.log(res) //=> If still fresh, the cached response, otherwise it makes a new request.
})
Options
- store Custom (promise-based) store for response data (
Store
instance, default:FileSystemStore
) - cache Use a synchronous in-memory store (
number
,false
or cache instance, default:LRUCache({ max: 50000 })
) - staleFallback Fallback to the stale response when the network is unavailable (default:
true
)
The built-in filesystem store handles race conditions by queuing file reads and writes.
Please note: Streaming response bodies are never cached.
License
MIT license