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 !== '') {
|
if (url && url !== '/' && url !== '') {
|
||||||
|
const exists = await client.exists('cozy:url:' + url)
|
||||||
// try cache
|
// try cache
|
||||||
|
if (exists) {
|
||||||
article = (await client.json.get('cozy:url:' + url)) as ArticleData
|
article = (await client.json.get('cozy:url:' + url)) as ArticleData
|
||||||
if (article !== null) {
|
|
||||||
console.log('>>> Using cached content', article.url)
|
console.log('>>> Using cached content', article.url)
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue