()
| 11 | } |
| 12 | |
| 13 | async function cleanupExpiredCache() { |
| 14 | try { |
| 15 | await prisma.cache.deleteMany({ |
| 16 | where: { |
| 17 | expiresAt: { |
| 18 | lt: new Date(), |
| 19 | }, |
| 20 | }, |
| 21 | }); |
| 22 | } catch (error) { |
| 23 | console.error('Failed to cleanup expired cache:', error); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | export async function getCache<T>(key: string): Promise<T | null> { |
| 28 | if (!Settings.CACHE_ENABLED) { |