cacheable-response
Advanced tools
Comparing version 1.5.2 to 1.6.0
@@ -5,2 +5,16 @@ # Change Log | ||
# [1.6.0](https://github.com/Kikobeats/cacheable-response/compare/v1.5.2...v1.6.0) (2019-05-05) | ||
### Bug Fixes | ||
* **package:** update pretty-ms to version 5.0.0 ([63c6dab](https://github.com/Kikobeats/cacheable-response/commit/63c6dab)) | ||
### Features | ||
* expose .getKey method ([3603e4d](https://github.com/Kikobeats/cacheable-response/commit/3603e4d)), closes [#11](https://github.com/Kikobeats/cacheable-response/issues/11) [#22](https://github.com/Kikobeats/cacheable-response/issues/22) | ||
<a name="1.5.2"></a> | ||
@@ -7,0 +21,0 @@ ## [1.5.2](https://github.com/Kikobeats/cacheable-response/compare/v1.5.1...v1.5.2) (2019-04-11) |
@@ -13,3 +13,4 @@ 'use strict' | ||
const getKey = url => { | ||
const _getKey = req => { | ||
const url = urlResolve('http://localhost', req.url) | ||
const { origin } = new URL(url) | ||
@@ -47,2 +48,3 @@ const baseKey = normalizeUrl(url, { | ||
compress: enableCompression = false, | ||
getKey = _getKey, | ||
get, | ||
@@ -70,3 +72,3 @@ send, | ||
) | ||
const key = getKey(urlResolve('http://localhost', req.url)) | ||
const key = getKey(req) | ||
const cachedResult = await decompress(await cache.get(key)) | ||
@@ -104,2 +106,2 @@ const isHit = !hasForce && cachedResult !== undefined | ||
module.exports.getKey = getKey | ||
module.exports.getKey = _getKey |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://nicedoc.io/Kikobeats/cacheable-response", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"main": "index.js", | ||
@@ -36,3 +36,3 @@ "author": { | ||
"normalize-url": "~4.3.0", | ||
"pretty-ms": "~4.0.0" | ||
"pretty-ms": "~5.0.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
@@ -125,3 +125,3 @@ # cacheable-response | ||
Type: `boolean`<br> | ||
Type: `boolean`<br/> | ||
Default: `new Keyv({ namespace: 'ssr' })` | ||
@@ -137,3 +137,3 @@ | ||
Type: `number`<br> | ||
Type: `number`<br/> | ||
Default: `7200000` | ||
@@ -151,3 +151,3 @@ | ||
Type: `function`<br> | ||
Type: `function`<br/> | ||
Default: `JSON.stringify` | ||
@@ -159,3 +159,3 @@ | ||
Type: `function`<br> | ||
Type: `function`<br/> | ||
Default: `JSON.parse` | ||
@@ -167,3 +167,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`<br/> | ||
Default: `false` | ||
@@ -181,3 +181,3 @@ | ||
Type: `function`|`number`<br> | ||
Type: `function`|`number`<br/> | ||
Default: `ttl => ttl / 24` | ||
@@ -191,6 +191,13 @@ | ||
##### getKey | ||
Type: `function`<br/> | ||
Default: `req => normalizeUrl(req.url)` | ||
It determinates how the cache key should be computed using `req` as input. | ||
##### get | ||
_Required_<br> | ||
Type: `function`<br> | ||
_Required_<br/> | ||
Type: `function`<br/> | ||
@@ -217,4 +224,4 @@ The method to be called for creating a fresh cacheable response associated with the current route path. | ||
_Required_<br> | ||
Type: `function`<br> | ||
_Required_<br/> | ||
Type: `function`<br/> | ||
@@ -300,5 +307,5 @@ The method used to determinate how the content should be rendered. | ||
**cacheable-response** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/cacheable-response/blob/master/LICENSE.md) License.<br> | ||
**cacheable-response** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/cacheable-response/blob/master/LICENSE.md) License.<br/> | ||
Authored and maintained by Kiko Beats with help from [contributors](https://github.com/Kikobeats/cacheable-response/contributors). | ||
> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · Twitter [@Kikobeats](https://twitter.com/Kikobeats) |
21953
87
303
+ Addedpretty-ms@5.0.0(transitive)
- Removedpretty-ms@4.0.0(transitive)
Updatedpretty-ms@~5.0.0