File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
const config = {
2
2
experimental : {
3
3
useCache : true ,
4
+ cacheComponents : true ,
4
5
reactCompiler : true ,
5
6
} ,
6
7
Original file line number Diff line number Diff line change
1
+ 'use server' ;
1
2
import { unstable_cache } from 'next/cache' ;
3
+ import { unstable_cacheTag as cacheTag } from 'next/cache'
4
+
2
5
3
6
export const funcA = async ( ) => {
4
7
"use cache" ;
8
+ cacheTag ( 'func-a-tag' )
5
9
await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
6
10
return Math . random ( ) ;
7
11
}
@@ -14,6 +18,6 @@ const rand = async () => {
14
18
15
19
export const funcAUnstableCache = unstable_cache (
16
20
rand ,
17
- [ ] , // cache keys here; leave [] for simple global cache
18
- { revalidate : 60 } , // revalidate period in seconds, or use false for infinite
21
+ [ 'specific-key' ] , // cache keys here; leave [] for simple global cache
22
+ { revalidate : 600 } , // revalidate period in seconds, or use false for infinite
19
23
) ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { getStatus } from "../../status";
11
11
import { PublisherIcon } from "../PublisherIcon" ;
12
12
import { PublisherTag } from "../PublisherTag" ;
13
13
import { PublishersCard } from "./publishers-card" ;
14
- import { funcA , funcAUnstableCache } from "./util" ;
14
+ import { funcA , funcAUnstableCache } from '../../app/actions' ;
15
15
16
16
type Props = {
17
17
params : Promise < {
You can’t perform that action at this time.
0 commit comments