-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added caching for document result Layers
- Loading branch information
Showing
5 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
server/src/main/kotlin/org/ivdnt/galahad/app/CacheStatsReporter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ivdnt.galahad.app | ||
|
||
import org.springframework.scheduling.annotation.Scheduled | ||
import org.apache.logging.log4j.kotlin.Logging | ||
import org.ivdnt.galahad.FileBackedValue | ||
import org.ivdnt.galahad.util.toFixed | ||
import org.springframework.stereotype.Component | ||
import java.util.concurrent.TimeUnit | ||
|
||
@Component | ||
class CacheStatsReporter : Logging { | ||
@Scheduled(fixedDelay = 10, timeUnit = TimeUnit.MINUTES) | ||
fun reportStats() { | ||
val stats = FileBackedValue.cache.stats() | ||
logger.info("Cache hit rate: ${stats.hitRate().toFixed()} [hit: ${stats.hitCount()} miss: ${stats.missCount()} evictions: ${stats.evictionCount()}]") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters