Skip to content

Commit e7de738

Browse files
committed
fix: missing analyzer cache duration
1 parent c44af97 commit e7de738

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

analysis/src/main/java/org/eclipse/jifa/analysis/AbstractApiExecutor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.concurrent.CompletionException;
4949
import java.util.concurrent.ConcurrentHashMap;
5050
import java.util.concurrent.Future;
51+
import java.util.concurrent.TimeUnit;
5152
import java.util.concurrent.atomic.AtomicBoolean;
5253

5354
import static org.eclipse.jifa.analysis.listener.ProgressListener.NoOpProgressListener;
@@ -79,6 +80,7 @@ protected AbstractApiExecutor() {
7980
cachedAnalyzer = Caffeine.newBuilder()
8081
.scheduler(Scheduler.systemScheduler())
8182
.softValues()
83+
.expireAfterAccess(getCacheDuration(), TimeUnit.MINUTES)
8284
.removalListener((RemovalListener<Object, Analyzer>) (key, analyzer, cause) -> cachedAnalyzerRemoved(analyzer))
8385
.build();
8486
}
@@ -355,4 +357,11 @@ protected File errorLogFile(Path path) {
355357
protected final boolean isActive(Path target) {
356358
return cachedAnalyzer.getIfPresent(target) != null || buildingAnalyzer.containsKey(target);
357359
}
360+
361+
/**
362+
* @return cache duration in minutes
363+
*/
364+
protected int getCacheDuration() {
365+
return 8;
366+
}
358367
}

0 commit comments

Comments
 (0)