Fixed expiresAt value depending of cache hit/miss
This commit is contained in:
@@ -63,7 +63,12 @@ export const fetchAndCacheEntry = async (path: string, lang?: Lang) => {
|
||||
}
|
||||
|
||||
const { contentType, uid } = await resolveEntry(path, lang)
|
||||
const expiresAt = Date.now() / 1000 + 3600
|
||||
let expiresAt = Date.now() / 1000
|
||||
if (!contentType || !uid) {
|
||||
expiresAt += 600
|
||||
} else {
|
||||
expiresAt += 3600 * 12
|
||||
}
|
||||
const entryCache = { contentType, uid, expiresAt }
|
||||
size += JSON.stringify(entryCache).length
|
||||
console.log("[CMS MIDDLEWARE] Adding to cache", entryCache)
|
||||
|
||||
Reference in New Issue
Block a user