feat: use redis.exists to check before using cached content

This commit is contained in:
Ayo Ayco 2025-08-08 10:34:39 +02:00
parent d9fdf67c8a
commit da2dea9323

View file

@ -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 {