Comparing version 1.0.0 to 1.0.1
@@ -58,6 +58,4 @@ 'use strict'; | ||
var response = setCache(url, (0, _got2.default)(url, options)); | ||
// return got response for non-cached requests | ||
return response; | ||
// return got response but first set cache with it | ||
return setCache(url, (0, _got2.default)(url, options)); | ||
}); | ||
@@ -64,0 +62,0 @@ |
{ | ||
"name": "got-cached", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Got response cache for get requests", | ||
@@ -5,0 +5,0 @@ "author": "janneh", |
got-cached | ||
===================== | ||
Got cached is a provider of a cache wrapper around got (for http GET requests). | ||
Cache is expected to to have functions `set(key, value)` and `get(key)` | ||
(returning a Promise that resolves the value). | ||
Got cached provides a cache wrapper around `got` | ||
note: cache hits only include `response.status` (200) and `response.body` | ||
## Install | ||
``` | ||
$ npm install --save got-cached | ||
``` | ||
## Usage | ||
`gotChached` takes options that should include a cache object | ||
that is expected to to have the functions `set(key, value)` and `get(key)` | ||
(returning a Promise that resolves the value). | ||
Below is an example using `then-redis` to cache with a 10 minute expiry | ||
``` | ||
import fs from 'fs' | ||
@@ -29,5 +41,2 @@ import { createClient } from 'then-redis' | ||
}) | ||
// Streams are not cached, but still play nicely | ||
got.stream('todomvc.com').pipe(fs.createWriteStream('index.html')) | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73227
15
528
42
1