Skip to content

Commit 03dc322

Browse files
committed
feat: updated caching
1 parent 98348d5 commit 03dc322

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apps/insights/src/cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const transformer = {
1010
};
1111

1212
/**
13-
* - API routes will be cached for 1hour
13+
* - API routes will be cached for 1 hour
1414
* - Cached function will be cached for 10 minutes,
15-
* but if the function is called within 1 hour, it will
16-
* still be served from the cache but also fetch the latest data
15+
* If the function is called within 1 hour, it will
16+
* still be served from the cache, but also fetch the latest data
1717
*/
1818
export const DEFAULT_NEXT_FETCH_TTL = 3600; // 1 hour
1919
export const DEFAULT_REDIS_CACHE_TTL = 60 * 10; // 10 minutes

apps/insights/src/server/pyth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { parse } from "superjson";
22
import { z } from "zod";
33

4-
import { DEFAULT_NEXT_CACHE_TTL } from "../cache";
4+
import { DEFAULT_NEXT_FETCH_TTL } from "../cache";
55
import { VERCEL_REQUEST_HEADERS } from "../config/server";
66
import { getHost } from "../get-host";
77
import { Cluster, ClusterToName, priceFeedsSchema } from "../services/pyth";
@@ -18,7 +18,7 @@ export async function getPublishersForFeedRequest(
1818

1919
const data = await fetch(url, {
2020
next: {
21-
revalidate: DEFAULT_NEXT_CACHE_TTL,
21+
revalidate: DEFAULT_NEXT_FETCH_TTL,
2222
},
2323
headers: VERCEL_REQUEST_HEADERS,
2424
});
@@ -38,7 +38,7 @@ export async function getFeedsForPublisherRequest(
3838

3939
const data = await fetch(url, {
4040
next: {
41-
revalidate: DEFAULT_NEXT_CACHE_TTL,
41+
revalidate: DEFAULT_NEXT_FETCH_TTL,
4242
},
4343
headers: VERCEL_REQUEST_HEADERS,
4444
});
@@ -54,7 +54,7 @@ export const getFeedsRequest = async (cluster: Cluster) => {
5454

5555
const data = await fetch(url, {
5656
next: {
57-
revalidate: DEFAULT_NEXT_CACHE_TTL,
57+
revalidate: DEFAULT_NEXT_FETCH_TTL,
5858
},
5959
headers: VERCEL_REQUEST_HEADERS,
6060
});
@@ -82,7 +82,7 @@ export const getFeedForSymbolRequest = async ({
8282

8383
const data = await fetch(url, {
8484
next: {
85-
revalidate: DEFAULT_NEXT_CACHE_TTL,
85+
revalidate: DEFAULT_NEXT_FETCH_TTL,
8686
},
8787
headers: VERCEL_REQUEST_HEADERS,
8888
});

0 commit comments

Comments
 (0)