@@ -100,13 +100,13 @@ export const fetchFile = createServerFn({ method: 'GET' })
100
100
throw notFound ( )
101
101
}
102
102
103
- // // Cache for 5 minutes on shared cache
104
- // // Revalidate in the background
105
- // setHeader('Cache-Control', 'public, max-age=0, must-revalidate')
106
- // setHeader(
107
- // 'CDN-Cache-Control',
108
- // 'max-age=300 , stale-while-revalidate=300 , durable'
109
- // )
103
+ // Cache for 60 minutes on shared cache
104
+ // Revalidate in the background
105
+ setHeader ( 'Cache-Control' , 'public, max-age=0, must-revalidate' )
106
+ setHeader (
107
+ 'CDN-Cache-Control' ,
108
+ 'max-age=3600 , stale-while-revalidate=3600 , durable'
109
+ )
110
110
111
111
return file
112
112
} )
@@ -123,5 +123,14 @@ export const fetchRepoDirectoryContents = createServerFn({
123
123
)
124
124
. handler ( async ( { data : { repo, branch, startingPath } } ) => {
125
125
const githubContents = await fetchApiContents ( repo , branch , startingPath )
126
+
127
+ // Cache for 60 minutes on shared cache
128
+ // Revalidate in the background
129
+ setHeader ( 'Cache-Control' , 'public, max-age=0, must-revalidate' )
130
+ setHeader (
131
+ 'CDN-Cache-Control' ,
132
+ 'max-age=3600, stale-while-revalidate=3600, durable'
133
+ )
134
+
126
135
return githubContents
127
136
} )
0 commit comments