Skip to content

Commit

Permalink
add caching to getting events
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Sep 8, 2024
1 parent e89b8a3 commit c8eacdf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
}
});
}
reply.send(parsedItems);
reply
.header(
"cache-control",
"public, max-age=7200, stale-while-revalidate=900, stale-if-error=86400",
)
.send(parsedItems);
} catch (e: unknown) {
if (e instanceof Error) {
request.log.error("Failed to get from DynamoDB: " + e.toString());
Expand Down

0 comments on commit c8eacdf

Please sign in to comment.