Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Jan 20, 2025
1 parent 32dcf85 commit 8b4a180
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ abstract class AbstractTieredCache<V extends MoshiExchange> implements TieredCac
// use the loader function to fetch the value
V value = null
if( loader!=null ) {
if( log.isTraceEnabled() )
if( entry && needsRevalidation )
log.debug "Cache '${name}' invoking loader - entry=$entry needs refresh"
else if( log.isTraceEnabled() )
log.trace "Cache '${name}' invoking loader - key=$key"
final ret = loader.apply(key)
value = ret?.v1
Expand Down Expand Up @@ -290,7 +292,6 @@ abstract class AbstractTieredCache<V extends MoshiExchange> implements TieredCac
}

protected boolean shouldRevalidate(long expiration, Instant time=Instant.now()) {

// when 'remainingCacheTime' is less than or equals to zero, it means
// the current time is beyond the expiration time, therefore a cache validation is needed
final remainingCacheTime = expiration - time.toEpochMilli()
Expand Down

0 comments on commit 8b4a180

Please sign in to comment.