(id: string)
| 12 | }>; |
| 13 | |
| 14 | export async function getProjectById(id: string) { |
| 15 | const res = await db.project.findUnique({ |
| 16 | where: { |
| 17 | id, |
| 18 | }, |
| 19 | }); |
| 20 | |
| 21 | if (!res) { |
| 22 | return null; |
| 23 | } |
| 24 | |
| 25 | return res; |
| 26 | } |
| 27 | |
| 28 | /** L1 LRU (60s) + L2 Redis. clear() invalidates Redis + local LRU; other nodes may serve stale from LRU for up to 60s. */ |
| 29 | export const getProjectByIdCached = cacheable(getProjectById, 60 * 60 * 24); |
no outgoing calls
no test coverage detected