feat: prefix redis key with 'cozy:url:'
This commit is contained in:
parent
1c7ca35d85
commit
4b3d4bca19
1 changed files with 2 additions and 2 deletions
|
@ -22,7 +22,7 @@ while (url?.startsWith(Astro.url.origin)) {
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
// try cache
|
// try cache
|
||||||
article = (await client.json.get(url)) as ArticleData
|
article = (await client.json.get('cozy:url:' + url)) as ArticleData
|
||||||
if (article !== null) {
|
if (article !== null) {
|
||||||
console.log('>>> Using cached content', article.url)
|
console.log('>>> Using cached content', article.url)
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,7 @@ if (url) {
|
||||||
console.log('>>> Using fetched content', article?.url)
|
console.log('>>> Using fetched content', article?.url)
|
||||||
if (article !== null) {
|
if (article !== null) {
|
||||||
// cache via redis
|
// cache via redis
|
||||||
await client.json.set(url, '$', article)
|
await client.json.set('cozy:url:' + url, '$', article)
|
||||||
console.log('>>> Added to cache', article.url)
|
console.log('>>> Added to cache', article.url)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in a new issue