From 589a42afc87566f40b1d68b4c46dcd8fc0a6e816 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Wed, 13 Nov 2024 00:29:27 -0600 Subject: [PATCH] cache org list for up to 4 hours --- src/routes/organizations.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/routes/organizations.ts b/src/routes/organizations.ts index 7d01050..ec4871d 100644 --- a/src/routes/organizations.ts +++ b/src/routes/organizations.ts @@ -1,7 +1,13 @@ import { FastifyPluginAsync } from "fastify"; import { OrganizationList } from "../orgs.js"; +import fastifyCaching from "@fastify/caching"; const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => { + fastify.register(fastifyCaching, { + privacy: fastifyCaching.privacy.PUBLIC, + serverExpiresIn: 60 * 60 * 4, + expiresIn: 60 * 60 * 4, + }); fastify.get("/", {}, async (request, reply) => { reply.send(OrganizationList); });