cacheable-request
Advanced tools
+1
-1
| { | ||
| "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", |
+9
-2
@@ -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 @@ |
+6
-1
@@ -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) { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
15839
1.42%194
1.57%205
3.54%