Skip to content

Commit 6e824aa

Browse files
committed
chore: test use cache
1 parent b9eaee7 commit 6e824aa

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

apps/insights/src/server/pyth.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export async function getFeedsForPublisherCached(
3838
return parse<z.infer<typeof priceFeedsSchema>>(rawData);
3939
}
4040

41-
const _privateGetFeeds =unstable_cache(async (cluster: Cluster) => {
41+
const _privateGetFeeds =async (cluster: Cluster) => {
42+
'use cache'
4243
const start = Date.now();
4344
await new Promise((resolve) => setTimeout(resolve, 10_000));
4445
const feeds = await _getFeedsCached(cluster) as Omit<z.infer<typeof priceFeedsSchema>[number], 'price'>[];
@@ -60,9 +61,7 @@ const _privateGetFeeds =unstable_cache(async (cluster: Cluster) => {
6061
// const dataJson = await data.text();
6162
// const feeds: Omit<z.infer<typeof priceFeedsSchema>[0], "price">[] = parse(dataJson);
6263
// return feeds;
63-
}, ['getFeedsCached__'], {
64-
revalidate: DEFAULT_CACHE_TTL,
65-
});
64+
}
6665

6766
export const getFeedsCached = async (cluster: Cluster) => {
6867
const start = Date.now();
@@ -81,14 +80,13 @@ const _getFeedsForSymbol = async (symbol: string, cluster: Cluster) => {
8180

8281

8382

84-
export const getFeedForSymbol = unstable_cache(async ({symbol, cluster = Cluster.Pythnet}: {symbol: string, cluster?: Cluster}) => {
83+
export const getFeedForSymbol = async ({symbol, cluster = Cluster.Pythnet}: {symbol: string, cluster?: Cluster}) => {
84+
'use cache'
8585
const data = await _getFeedsForSymbol(symbol, cluster);
8686
await new Promise((resolve) => setTimeout(resolve, 10_000));
8787

8888
return stringify(data);
89-
}, ['getFeedForSymbolCached__'], {
90-
revalidate: DEFAULT_CACHE_TTL,
91-
});
89+
}
9290

9391
export const getFeedForSymbolCached = async ({symbol, cluster = Cluster.Pythnet}: {symbol: string, cluster?: Cluster}) => {
9492
const start = Date.now();

0 commit comments

Comments
 (0)