diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/cache/CaffeineConfiguration.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/cache/CaffeineConfiguration.kt index bd21d715ca..eac7b7c611 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/cache/CaffeineConfiguration.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/cache/CaffeineConfiguration.kt @@ -129,9 +129,9 @@ class CaffeineConfiguration { val missionControlUnitsCache = buildMinutesCache(missionControlUnits, ticker, 120) // Ports - val portsCache = buildMinutesCache(ports, ticker, oneWeek) - val activePortsCache = buildMinutesCache(activePorts, ticker, oneDay) - val portCache = buildMinutesCache(port, ticker, oneWeek) + val portsCache = buildPermanentCache(ports) + val activePortsCache = buildPermanentCache(activePorts) + val portCache = buildPermanentCache(port) // Risk Factors val riskFactorCache = buildMinutesCache(riskFactor, ticker, 1) @@ -245,6 +245,17 @@ class CaffeineConfiguration { ) } + private fun buildPermanentCache( + name: String, + ): CaffeineCache { + return CaffeineCache( + name, + Caffeine.newBuilder() + .recordStats() + .build(), + ) + } + private fun buildSecondsCache( name: String, ticker: Ticker,