fix: update cache configuration to use dynamic revalidate values in Google Sheets API route
This commit is contained in:
1 parent
c243a7b189
commit
999c65a018
1 file changed
+2
-2
@@ -3,7 +3,7 @@ import { NextResponse } from 'next/server';
|
||||
|
||||
|
||||
// Configurar cache (sempre exportar um número, 0 = sem cache)
|
||||
export const revalidate = 60 * 10; // 10 minutos
|
||||
export const revalidate = 600; // 10 minutos
|
||||
|
||||
// Habilitar/desabilitar cache
|
||||
const ENABLE_CACHE = revalidate > 0;
|
||||
@@ -37,7 +37,7 @@ export async function GET() {
|
||||
});
|
||||
|
||||
const responseHeaders = ENABLE_CACHE ? {
|
||||
'Cache-Control': 'public, s-maxage=3600, stale-while-revalidate=7200'
|
||||
'Cache-Control': `public, s-maxage=${revalidate}, stale-while-revalidate=${revalidate * 2}`
|
||||
} : {
|
||||
'Cache-Control': 'no-store, no-cache, must-revalidate'
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user