Skip to content

Commit

Permalink
Cache ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Sep 23, 2024
1 parent 2a33bc3 commit 335a039
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/resolve-notion-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export async function resolveNotionPage(domain: string, rawPageId?: string) {
const useUriToPageIdCache = true
const cacheKey = `uri-to-page-id:${domain}:${environment}:${rawPageId}`
// TODO: should we use a TTL for these mappings or make them permanent?
const cacheTTL = 8.64e7 // one day in milliseconds
// const cacheTTL = undefined // disable cache TTL
// const cacheTTL = 8.64e7 // one day in milliseconds
const cacheTTL = undefined // disable cache TTL

if (!pageId && useUriToPageIdCache) {
try {
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = withBundleAnalyzer({
remotePatterns: [
{ hostname: '**.nline.io' },
{ hostname: '**.notion.so' },
{ hostname: '**.notionusercontent.com' },
{ hostname: 'images.unsplash.com' },
{ hostname: 'pbs.twimg.com' },
{ hostname: 'abs.twimg.com' },
Expand Down
2 changes: 1 addition & 1 deletion pages/api/recent-posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Response = {
*/
export default async function (req: NextApiRequest, res: NextApiResponse) {
const siteMap = await getSiteMap()
const ttl = 24 * 60 * 60 // 24 hours
const ttl = 1 * 60 * 60 // 24 hours
// const ttl = undefined // disable cache TTL
const data: Response = {
posts: []
Expand Down

0 comments on commit 335a039

Please sign in to comment.