From 105d8301141860a7e2bebd67f5c64eeb4e7a7c45 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 2 Oct 2015 11:55:36 +0200 Subject: [PATCH] Correct condition for when time is needed --- core/src/main/java/org/elasticsearch/common/cache/Cache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/common/cache/Cache.java b/core/src/main/java/org/elasticsearch/common/cache/Cache.java index 962ab2f536b..373b32aa7a5 100644 --- a/core/src/main/java/org/elasticsearch/common/cache/Cache.java +++ b/core/src/main/java/org/elasticsearch/common/cache/Cache.java @@ -117,7 +117,7 @@ public class Cache { */ protected long now() { // System.nanoTime takes non-negligible time, so we only use it if we need it - return expireAfterAccess == -1 ? 0 : System.nanoTime(); + return expireAfterWrite != -1 || expireAfterAccess != -1 ? System.nanoTime() : 0; } public void setExpireAfterWrite(long expireAfterWrite) {