add server cache

This commit is contained in:
MuslemRahimi 2024-06-09 10:46:34 +02:00
parent 26c028e4ac
commit 5da5ded55a
3 changed files with 12 additions and 14 deletions

View File

@ -61,7 +61,7 @@ async function fetchPortfolio(fastifyURL, userId)
return output
}
export const load = async ({ params, locals}) => {
export const load = async ({ params, locals, setHeaders}) => {
const userRegion = locals.region?.split("::")[0];
@ -102,11 +102,11 @@ export const load = async ({ params, locals}) => {
getUserPortfolio,
] = await Promise.all(promises);
/*
setHeaders({
'cache-control': 'public, max-age=500'
'cache-control': 'public, max-age=300'
});
*/
return {
getCryptoProfile,

View File

@ -85,7 +85,7 @@ async function fetchPortfolio(fastifyURL, userId)
return output
}
export const load = async ({ params, locals}) => {
export const load = async ({ params, locals, setHeaders}) => {
const userRegion = locals.region?.split("::")[0];
@ -135,11 +135,11 @@ const promises = [
getUserPortfolio,
] = await Promise.all(promises);
/*
setHeaders({
'cache-control': 'public, max-age=500'
'cache-control': 'public, max-age=300'
});
*/
return {
getETFProfile,

View File

@ -115,7 +115,7 @@ async function fetchCommunitySentiment(pb, ticker, cookies)
}
export const load = async ({ params, locals, cookies}) => {
export const load = async ({ params, locals, cookies, setHeaders}) => {
const userRegion = locals?.region?.split("::")[0];
@ -174,17 +174,15 @@ export const load = async ({ params, locals, cookies}) => {
getCommunitySentiment,
] = await Promise.all(promises);
/*
setHeaders({
'cache-control': 'public, max-age=500'
'cache-control': 'public, max-age=300' //Cache data for 5 min
});
*/
return {
getFairPrice,
getSimilarStock,
//getPricePrediction,
//getTradingSignals,
getStockDeck,
getCorrelation,
getAnalystRating,