🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cacheable-request

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable-request - npm Package Compare versions

Comparing version

to
5.1.0

2

package.json
{
"name": "cacheable-request",
"version": "5.0.0",
"version": "5.1.0",
"description": "Wrap native HTTP requests with RFC compliant cache support",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -134,6 +134,13 @@ # cacheable-request

If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated on the next request with `If-None-Match`/`If-Modified-Since` headers.
If set to `true` once a cached resource has expired it is deleted and will have to be re-requested.
If set to `false` (default), after a cached resource's TTL expires it is kept in the cache and will be revalidated on the next request with `If-None-Match`/`If-Modified-Since` headers.
###### opts.maxTtl
Type: `number`<br>
Default: `undefined`
Limits TTL. The `number` represents milliseconds.
###### opts.automaticFailover

@@ -140,0 +147,0 @@

@@ -100,3 +100,8 @@ 'use strict';

};
const ttl = opts.strictTtl ? response.cachePolicy.timeToLive() : undefined;
let ttl = opts.strictTtl ? response.cachePolicy.timeToLive() : undefined;
if (opts.maxTtl) {
ttl = ttl ? Math.min(ttl, opts.maxTtl) : opts.maxTtl;
}
await this.cache.set(key, value, ttl);

@@ -103,0 +108,0 @@ } catch (err) {