Skip to content

Commit 589a42a

Browse files
committed
cache org list for up to 4 hours
1 parent 5bac54c commit 589a42a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/routes/organizations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { FastifyPluginAsync } from "fastify";
22
import { OrganizationList } from "../orgs.js";
3+
import fastifyCaching from "@fastify/caching";
34

45
const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
6+
fastify.register(fastifyCaching, {
7+
privacy: fastifyCaching.privacy.PUBLIC,
8+
serverExpiresIn: 60 * 60 * 4,
9+
expiresIn: 60 * 60 * 4,
10+
});
511
fastify.get("/", {}, async (request, reply) => {
612
reply.send(OrganizationList);
713
});

0 commit comments

Comments
 (0)