From da2dea932371004e5e495101c6187d719ab9d5bb Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 8 Aug 2025 10:34:39 +0200 Subject: [PATCH] feat: use redis.exists to check before using cached content --- src/pages/index.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 7e734b2..8691ed2 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -21,9 +21,10 @@ while (url?.startsWith(Astro.url.origin)) { } if (url && url !== '/' && url !== '') { + const exists = await client.exists('cozy:url:' + url) // try cache - article = (await client.json.get('cozy:url:' + url)) as ArticleData - if (article !== null) { + if (exists) { + article = (await client.json.get('cozy:url:' + url)) as ArticleData console.log('>>> Using cached content', article.url) } else { try {