perf(permissions): cache space role and page edit lookups (#2208)

This commit is contained in:
Philip Okugbe
2026-05-14 13:11:28 +01:00
committed by GitHub
parent f4af4c3fc0
commit f758091b2a
4 changed files with 125 additions and 88 deletions
@@ -1,3 +1,11 @@
export const CacheKey = {
LICENSE_VALID: (workspaceId: string) => `license:valid:${workspaceId}`,
SPACE_ROLES: (userId: string, spaceId: string) =>
`perm:space-roles:${userId}:${spaceId}`,
PAGE_CAN_EDIT: (userId: string, pageId: string) =>
`perm:can-edit:${userId}:${pageId}`,
};
// Permission caches dedupe repeated checks within and across short request bursts.
// 5s keeps staleness on revocations bounded.
export const PERMISSION_CACHE_TTL_MS = 5_000;