Skip to content

Commit

Permalink
cache org list for up to 4 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Nov 13, 2024
1 parent 5bac54c commit 589a42a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/organizations.ts
Original file line number Diff line number Diff line change
@@ -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);
});
Expand Down

0 comments on commit 589a42a

Please sign in to comment.