feat: use redis.exists to check before using cached content
This commit is contained in:
parent
d9fdf67c8a
commit
da2dea9323
1 changed files with 3 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue