Skip to content

Commit 970fec1

Browse files
committed
chore: test with function tags
1 parent c8f9edb commit 970fec1

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

apps/insights/next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const config = {
22
experimental: {
33
useCache: true,
4+
cacheComponents: true,
45
reactCompiler: true,
56
},
67

apps/insights/src/components/PriceFeed/util.ts renamed to apps/insights/src/app/actions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
'use server';
12
import { unstable_cache } from 'next/cache';
3+
import { unstable_cacheTag as cacheTag } from 'next/cache'
4+
25

36
export const funcA = async () => {
47
"use cache";
8+
cacheTag('func-a-tag')
59
await new Promise((resolve) => setTimeout(resolve, 2000));
610
return Math.random();
711
}
@@ -14,6 +18,6 @@ const rand = async () => {
1418

1519
export const funcAUnstableCache = unstable_cache(
1620
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
1923
);

apps/insights/src/components/PriceFeed/publishers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { getStatus } from "../../status";
1111
import { PublisherIcon } from "../PublisherIcon";
1212
import { PublisherTag } from "../PublisherTag";
1313
import { PublishersCard } from "./publishers-card";
14-
import { funcA, funcAUnstableCache } from "./util";
14+
import { funcA, funcAUnstableCache } from '../../app/actions';
1515

1616
type Props = {
1717
params: Promise<{

0 commit comments

Comments
 (0)