File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } ) ;
You can’t perform that action at this time.
0 commit comments