@quantos/micro-request
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -7,2 +7,3 @@ import { MicroRequestOptions } from './micro_request_options'; | ||
fallback?: T[]; | ||
cache404?: boolean; | ||
} |
@@ -75,2 +75,9 @@ "use strict"; | ||
} | ||
if (options.cache404) { | ||
for (const id of options.ids) { | ||
if (fetched.map((u) => u.id).indexOf(id) < 0) { | ||
yield redis_cache_1.RedisCache.set(id, null, _cachePrefix); | ||
} | ||
} | ||
} | ||
} | ||
@@ -77,0 +84,0 @@ results.push(...fetched); |
{ | ||
"name": "@quantos/micro-request", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Quantos http client with cache, retry and fallback mechanism", | ||
@@ -5,0 +5,0 @@ "author": "fabriziotognetto <info@quantos.it>", |
import { MicroRequestOptions } from './micro_request_options'; | ||
export interface MicroRequestGetManyOptions<Y, T> extends MicroRequestOptions { | ||
ids: Y[]; | ||
serviceUrl: string; | ||
url: (serviceUrl: string, ids: Y[]) => string; | ||
fallback?: T[]; | ||
ids: Y[]; | ||
serviceUrl: string; | ||
url: (serviceUrl: string, ids: Y[]) => string; | ||
fallback?: T[]; | ||
cache404?: boolean; | ||
} |
@@ -1,8 +0,7 @@ | ||
export interface MicroRequestOptions { | ||
cache?: boolean; | ||
cachePrefix?: string; | ||
headers?: any; | ||
retry?: number; | ||
retryTimeout?: number; | ||
cache?: boolean; | ||
cachePrefix?: string; | ||
headers?: any; | ||
retry?: number; | ||
retryTimeout?: number; | ||
} |
@@ -87,2 +87,9 @@ import { fallbackErrorHandler } from './fallback_error_handler'; | ||
} | ||
if (options.cache404) { | ||
for (const id of options.ids) { | ||
if (fetched.map((u) => u.id).indexOf(id) < 0) { | ||
await RedisCache.set<Y, T>(id, null, _cachePrefix); | ||
} | ||
} | ||
} | ||
} | ||
@@ -89,0 +96,0 @@ results.push(...fetched); |
Sorry, the diff of this file is not supported yet
40474
863