@@ -13,10 +13,18 @@ import { cacheProvider } from "../src/config/cache.ts";
1313const serviceProvider = new GithubApiService ( ) ;
1414const client = new GithubRepositoryService ( serviceProvider ) . repository ;
1515
16+ // Build cache control header with optimized caching strategy
17+ const cacheControlHeader = [
18+ "public" ,
19+ `max-age=${ CONSTANTS . CACHE_MAX_AGE } ` ,
20+ `s-maxage=${ CONSTANTS . CDN_CACHE_MAX_AGE } ` ,
21+ `stale-while-revalidate=${ CONSTANTS . STALE_WHILE_REVALIDATE } ` ,
22+ ] . join ( ", " ) ;
23+
1624const defaultHeaders = new Headers (
1725 {
1826 "Content-Type" : "image/svg+xml" ,
19- "Cache-Control" : `public, max-age= ${ CONSTANTS . CACHE_MAX_AGE } ` ,
27+ "Cache-Control" : cacheControlHeader ,
2028 } ,
2129) ;
2230
@@ -86,7 +94,7 @@ async function app(req: Request): Promise<Response> {
8694 status : error . status ,
8795 headers : new Headers ( {
8896 "Content-Type" : "text" ,
89- "Cache-Control" : `public, max-age= ${ CONSTANTS . CACHE_MAX_AGE } ` ,
97+ "Cache-Control" : cacheControlHeader ,
9098 } ) ,
9199 } ,
92100 ) ;
@@ -132,7 +140,7 @@ async function app(req: Request): Promise<Response> {
132140 status : userResponseInfo . code ,
133141 headers : new Headers ( {
134142 "Content-Type" : "text" ,
135- "Cache-Control" : `public, max-age= ${ CONSTANTS . CACHE_MAX_AGE } ` ,
143+ "Cache-Control" : cacheControlHeader ,
136144 } ) ,
137145 } ,
138146 ) ;
0 commit comments