Openstatus
www.openstatus.dev
1interface VercelCacheInfo {
2 description: string;
3 value: string;
4}
5
6export function parseXVercelCache(header: string): VercelCacheInfo {
7 const description = getCacheDescription(header);
8 return { description, value: header };
9}
10
11function getCacheDescription(key: string): string {
12 switch (key.toUpperCase()) {
13 case "MISS":
14 return "The response was not found in the edge cache and was fetched from the origin server.";
15 case "HIT":
16 return "The response was served from the edge cache.";
17 case "STALE":
18 return "The response was served from the edge cache. A background request to the origin server was made to update the content.";
19 case "PRERENDER":
20 return "The response was served from static storage.";
21 case "REVLIDATED":
22 return "The response was served from the origin server and the cache was refreshed due to an authorization from the user in the incoming request.";
23 default:
24 return "-";
25 }
26}