From 1df63dfb8b73e8ceb797c6ab88e5be2e770166dc Mon Sep 17 00:00:00 2001 From: Tal Arian Date: Thu, 9 Mar 2023 13:08:51 +0200 Subject: [PATCH] Rename isCacheValid to isCacheExpired (#312) --- .../java/com/jfrog/ide/idea/ui/LocalComponentsTree.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/jfrog/ide/idea/ui/LocalComponentsTree.java b/src/main/java/com/jfrog/ide/idea/ui/LocalComponentsTree.java index a2a6d7f8..cab61530 100644 --- a/src/main/java/com/jfrog/ide/idea/ui/LocalComponentsTree.java +++ b/src/main/java/com/jfrog/ide/idea/ui/LocalComponentsTree.java @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.concurrent.TimeUnit; /** * @author yahavi @@ -39,7 +40,7 @@ public class LocalComponentsTree extends ComponentsTree { private static final String SHOW_IN_PROJECT_DESCRIPTOR = "Show direct dependency in project descriptor"; private static final String NO_ISSUES = "Your project was scanned and we didn't find any security issues."; private static final String SCANNING = "Scanning..."; - private static final long VALID_CACHE_TIME = 7 * 24 * 60 * 60 * 1000; // 7 days + private static final long EXPIRED_CACHE_TIME = TimeUnit.DAYS.toMillis(7); // week private final ScanCache cache; @@ -205,11 +206,11 @@ private void setNodesFromCache() { } public boolean isCacheEmpty() { - return cache.getScanCacheObject() == null || !isCacheValid(); + return cache.getScanCacheObject() == null || isCacheExpired(); } - private boolean isCacheValid() { - return System.currentTimeMillis() - cache.getScanCacheObject().getScanTimestamp() < VALID_CACHE_TIME; + private boolean isCacheExpired() { + return System.currentTimeMillis() - cache.getScanCacheObject().getScanTimestamp() >= EXPIRED_CACHE_TIME; } /**