@quantos/micro-request
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -8,2 +8,3 @@ import { Entity } from './interfaces/entity'; | ||
declare function get<T>(options: MicroRequestGetOptions): Promise<T>; | ||
declare function invalidateOne(id: any, cachePrefix?: string): Promise<void>; | ||
declare const MicroRequest: { | ||
@@ -13,3 +14,4 @@ getOne: typeof getOne; | ||
get: typeof get; | ||
invalidateOne: typeof invalidateOne; | ||
}; | ||
export default MicroRequest; |
@@ -105,2 +105,12 @@ "use strict"; | ||
} | ||
function invalidateOne(id, cachePrefix) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
yield redis_cache_1.RedisCache.invalidate(id, cachePrefix); | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
}); | ||
} | ||
const MicroRequest = { | ||
@@ -110,4 +120,5 @@ getOne, | ||
get, | ||
invalidateOne, | ||
}; | ||
exports.default = MicroRequest; | ||
//# sourceMappingURL=micro_request.js.map |
@@ -8,2 +8,3 @@ import { Entity } from './interfaces/entity'; | ||
}): Promise<void>; | ||
static invalidate(id: any, cachePrefix?: string): Promise<void>; | ||
} |
@@ -81,4 +81,12 @@ "use strict"; | ||
} | ||
static invalidate(id, cachePrefix) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!_redisEnabled) { | ||
return; | ||
} | ||
yield redisClient.del(`${cachePrefix}:${id}`); | ||
}); | ||
} | ||
} | ||
exports.RedisCache = RedisCache; | ||
//# sourceMappingURL=redis_cache.js.map |
{ | ||
"name": "@quantos/micro-request", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Quantos http client with cache, retry and fallback mechanism", | ||
@@ -5,0 +5,0 @@ "author": "fabriziotognetto <info@quantos.it>", |
@@ -123,2 +123,10 @@ import { fallbackErrorHandler } from './fallback_error_handler'; | ||
async function invalidateOne(id: any, cachePrefix?: string): Promise<void> { | ||
try { | ||
await RedisCache.invalidate(id, cachePrefix); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
const MicroRequest = { | ||
@@ -128,4 +136,5 @@ getOne, | ||
get, | ||
invalidateOne, | ||
}; | ||
export default MicroRequest; |
@@ -69,2 +69,9 @@ import { createClient, RedisClientType } from 'redis'; | ||
} | ||
static async invalidate(id: any, cachePrefix?: string): Promise<void> { | ||
if (!_redisEnabled) { | ||
return; | ||
} | ||
await redisClient.del(`${cachePrefix}:${id}`); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
39352
844