Skip to content

Commit 18062f5

Browse files
author
matus.hudec
committed
Release 7.0.4-beta
1 parent 732ebcf commit 18062f5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/httpClient/redisStorage.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ export default function createRedisStorage(redisEndpoint: string) {
1414
// source https://axios-cache-interceptor.js.org/guide/storages#node-redis-storage
1515
return buildStorage({
1616
async find(key) {
17-
if (!client.isReady) await client.connect();
17+
if (!client.isReady) {
18+
await client.connect();
19+
}
1820
const result = await client.get(`${KEY_PREFIX}${key}`);
1921
return result ? (JSON.parse(result) as StorageValue) : undefined;
2022
},
2123

2224
// eslint-disable-next-line complexity
2325
async set(key, value, req) {
24-
if (!client.isReady) await client.connect();
26+
if (!client.isReady) {
27+
await client.connect();
28+
}
29+
2530
await client.set(`${KEY_PREFIX}${key}`, JSON.stringify(value), {
2631
PXAT:
2732
// We don't want to keep indefinitely values in the storage if
@@ -40,7 +45,9 @@ export default function createRedisStorage(redisEndpoint: string) {
4045
},
4146

4247
async remove(key) {
43-
if (!client.isReady) await client.connect();
48+
if (!client.isReady) {
49+
await client.connect();
50+
}
4451
await client.del(`${KEY_PREFIX}${key}`);
4552
},
4653
});

0 commit comments

Comments
 (0)