Skip to content

Commit

Permalink
fix: missing analyzer cache duration
Browse files Browse the repository at this point in the history
  • Loading branch information
D-D-H committed Dec 6, 2023
1 parent c44af97 commit e7de738
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.eclipse.jifa.analysis.listener.ProgressListener.NoOpProgressListener;
Expand Down Expand Up @@ -79,6 +80,7 @@ protected AbstractApiExecutor() {
cachedAnalyzer = Caffeine.newBuilder()
.scheduler(Scheduler.systemScheduler())
.softValues()
.expireAfterAccess(getCacheDuration(), TimeUnit.MINUTES)
.removalListener((RemovalListener<Object, Analyzer>) (key, analyzer, cause) -> cachedAnalyzerRemoved(analyzer))
.build();
}
Expand Down Expand Up @@ -355,4 +357,11 @@ protected File errorLogFile(Path path) {
protected final boolean isActive(Path target) {
return cachedAnalyzer.getIfPresent(target) != null || buildingAnalyzer.containsKey(target);
}

/**
* @return cache duration in minutes
*/
protected int getCacheDuration() {
return 8;
}
}

0 comments on commit e7de738

Please sign in to comment.