Skip to content

Commit 5ff320b

Browse files
committed
change fallback ttl to 30 mins
1 parent 0c1887e commit 5ff320b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/cloudflare/src/api/regional-cache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { CacheValue, IncrementalCache, WithLastModified } from "@opennextjs/aws/
44
import { getCloudflareContext } from "./cloudflare-context.js";
55
import { IncrementalCacheEntry } from "./internal/incremental-cache.js";
66

7-
const ONE_YEAR_IN_SECONDS = 31536000;
87
const ONE_MINUTE_IN_SECONDS = 60;
8+
const THIRTY_MINUTES_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 30;
99

1010
type Options = {
1111
/**
1212
* The mode to use for the regional cache.
1313
*
1414
* - `short-lived`: Re-use a cache entry for up to a minute after it has been retrieved.
15-
* - `long-lived`: Re-use a cache entry until it is revalidated.
15+
* - `long-lived`: Re-use a fetch cache entry until it is revalidated, or an ISR/SSG entry for up to 30 minutes.
1616
*/
1717
mode: "short-lived" | "long-lived";
1818
/**
@@ -133,7 +133,7 @@ class RegionalCache implements IncrementalCache {
133133
const age =
134134
this.opts.mode === "short-lived"
135135
? ONE_MINUTE_IN_SECONDS
136-
: entry.value.revalidate || ONE_YEAR_IN_SECONDS;
136+
: entry.value.revalidate || THIRTY_MINUTES_IN_SECONDS;
137137

138138
await cache.put(
139139
key,
@@ -156,7 +156,7 @@ class RegionalCache implements IncrementalCache {
156156
* @param cache - Incremental cache instance.
157157
* @param opts.mode - The mode to use for the regional cache.
158158
* - `short-lived`: Re-use a cache entry for up to a minute after it has been retrieved.
159-
* - `long-lived`: Re-use a cache entry until it is revalidated.
159+
* - `long-lived`: Re-use a fetch cache entry until it is revalidated, or an ISR/SSG entry for up to 30 minutes.
160160
* @param opts.shouldLazilyUpdateOnCacheHit - Whether the regional cache entry should be updated in
161161
* the background or not when it experiences a cache hit.
162162
*

0 commit comments

Comments
 (0)