diff --git a/.changeset/spotty-deers-suffer.md b/.changeset/spotty-deers-suffer.md new file mode 100644 index 0000000..92801db --- /dev/null +++ b/.changeset/spotty-deers-suffer.md @@ -0,0 +1,5 @@ +--- +"@soundxyz/fine-grained-cache": patch +--- + +When specifying forceUpdate: true, it should await for redis to set diff --git a/src/fineGrained.ts b/src/fineGrained.ts index 5182beb..fa94c63 100644 --- a/src/fineGrained.ts +++ b/src/fineGrained.ts @@ -686,7 +686,7 @@ export function FineGrainedCache({ ttl: expirySeconds, }).catch(onError); - if (awaitRedisSet) await set; + if (awaitRedisSet || forceUpdate) await set; } else { const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null; @@ -704,7 +704,7 @@ export function FineGrainedCache({ }) .catch(onError); - if (awaitRedisSet) await set; + if (awaitRedisSet || forceUpdate) await set; } } else if (ttl === "Infinity") { if (pipelineRedisSET) { @@ -713,7 +713,7 @@ export function FineGrainedCache({ value: stringifiedValue, }).catch(onError); - if (awaitRedisSet) await set; + if (awaitRedisSet || forceUpdate) await set; } else { const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null; @@ -731,7 +731,7 @@ export function FineGrainedCache({ }) .catch(onError); - if (awaitRedisSet) await set; + if (awaitRedisSet || forceUpdate) await set; } } else if (enabledLogEvents?.REDIS_SKIP_SET) { logMessage("REDIS_SKIP_SET", {