import { Logger } from '@pgpmjs/logger'; import { LRUCache } from 'lru-cache'; const log = new Logger('pg-cache'); const ONE_HOUR_IN_MS = 1000 * 60 * 60; const ONE_DAY = ONE_HOUR_IN_MS * 24; const ONE_YEAR = ONE_DAY * 366; export const SVC_CACHE_TTL_MS = ONE_YEAR; // --- Service Cache --- // Keep max aligned with PG_CACHE_MAX and GRAPHILE_CACHE_MAX (default: 50) export const svcCache = new LRUCache({ max: 50, ttl: SVC_CACHE_TTL_MS, updateAgeOnGet: true, dispose: (_, key) => { log.debug(`Disposing service[${key}]`); } });