Skip to content

Commit 2bb7c0b

Browse files
committed
Fixed ctor
1 parent 52cb73d commit 2bb7c0b

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

packages/nextjs-cache-handler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "git",
1111
"url": "git+https://github.com/fortedigital/nextjs-cache-handler.git"
1212
},
13-
"version": "1.3.0-canary3",
13+
"version": "1.3.0-canary4",
1414
"type": "module",
1515
"license": "MIT",
1616
"description": "Next.js cache handlers",

packages/nextjs-cache-handler/src/handlers/next-15-cache-handler.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,25 @@ import {
99
* https://github.com/caching-tools/next-shared-cache/issues/1027
1010
* https://github.com/vercel/next.js/commit/6a1b6336a3062dfdb1b9dddcee6b836da94fd198
1111
*/
12-
export class Next15CacheHandler extends CacheHandler {
13-
async set(
14-
cacheKey: string,
15-
incrementalCacheValue: IncrementalCacheValue | null,
16-
ctx: {
17-
revalidate?: number | false;
18-
fetchCache?: boolean;
19-
fetchUrl?: string;
20-
fetchIdx?: number;
21-
tags?: string[];
22-
} & { neshca_lastModified?: number },
23-
) {
24-
await super.set(cacheKey, incrementalCacheValue, {
25-
...ctx,
26-
revalidate:
27-
ctx.revalidate ||
28-
(incrementalCacheValue as CachedFetchValue)?.revalidate,
29-
});
30-
}
12+
export function Next15CacheHandler() {
13+
return class extends CacheHandler {
14+
async set(
15+
cacheKey: string,
16+
incrementalCacheValue: IncrementalCacheValue | null,
17+
ctx: {
18+
revalidate?: number | false;
19+
fetchCache?: boolean;
20+
fetchUrl?: string;
21+
fetchIdx?: number;
22+
tags?: string[];
23+
} & { neshca_lastModified?: number },
24+
) {
25+
await super.set(cacheKey, incrementalCacheValue, {
26+
...ctx,
27+
revalidate:
28+
ctx.revalidate ||
29+
(incrementalCacheValue as CachedFetchValue)?.revalidate,
30+
});
31+
}
32+
};
3133
}

0 commit comments

Comments
 (0)