Skip to content

Commit

Permalink
Ajout d'un cache sur le healthcheck (`sudden_drop_of_positions_receiv…
Browse files Browse the repository at this point in the history
…ed`) (#3469)

## Linked issues

- Resolve #3468
  • Loading branch information
louptheron authored Aug 1, 2024
2 parents 17562ce + 79c6314 commit b272aec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CaffeineConfiguration {
val controlAnteriority = "control_anteriority"
val district = "district"
val firstAndLastTripDates = "first_and_last_trip_dates"
val suddenDropOfPositionsReceived = "sudden_drop_of_positions_received"
val userAuthorization = "user_authorization"

@Bean
Expand Down Expand Up @@ -153,6 +154,7 @@ class CaffeineConfiguration {
val controlAnteriorityCache = buildMinutesCache(controlAnteriority, ticker, 1)
val districtCache = buildMinutesCache(district, ticker, 10)
val firstAndLastTripDates = buildMinutesCache(firstAndLastTripDates, ticker, 10)
val suddenDropOfPositionsReceivedCache = buildMinutesCache(suddenDropOfPositionsReceived, ticker, 2)
val userAuthorizationCache = buildMinutesCache(userAuthorization, ticker, 120)

val manager = SimpleCacheManager()
Expand Down Expand Up @@ -190,6 +192,7 @@ class CaffeineConfiguration {
searchBeaconsCache,
searchVesselsCache,
speciesCache,
suddenDropOfPositionsReceivedCache,
userAuthorizationCache,
vesselCache,
vesselsCache,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package fr.gouv.cnsp.monitorfish.infrastructure.database.repositories

import fr.gouv.cnsp.monitorfish.domain.repositories.RecentPositionsMetricsRepository
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.DBRecentPositionsMetricsRepository
import org.springframework.cache.annotation.Cacheable
import org.springframework.stereotype.Repository

@Repository
class JpaRecentPositionsMetricsRepository(
private val recentPositionsMetricsRepository: DBRecentPositionsMetricsRepository,
) : RecentPositionsMetricsRepository {

@Cacheable(value = ["sudden_drop_of_positions_received"])
override fun findSuddenDropOfPositionsReceived(): Boolean {
return recentPositionsMetricsRepository.findSuddenDropOfPositionsReceived()
}
Expand Down

0 comments on commit b272aec

Please sign in to comment.