Skip to content

Commit c8eacdf

Browse files
committed
add caching to getting events
1 parent e89b8a3 commit c8eacdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/routes/events.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,12 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
309309
}
310310
});
311311
}
312-
reply.send(parsedItems);
312+
reply
313+
.header(
314+
"cache-control",
315+
"public, max-age=7200, stale-while-revalidate=900, stale-if-error=86400",
316+
)
317+
.send(parsedItems);
313318
} catch (e: unknown) {
314319
if (e instanceof Error) {
315320
request.log.error("Failed to get from DynamoDB: " + e.toString());

0 commit comments

Comments
 (0)