Skip to content

Commit 2d7de46

Browse files
kopporsubhramit
andauthored
Increase file annotation cache from 10 to 1024 (#13424)
Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
1 parent d0717a0 commit 2d7de46

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

jablib/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@
1818
public class FileAnnotationCache {
1919

2020
private static final Logger LOGGER = LoggerFactory.getLogger(FileAnnotationCache.class);
21-
// cache size in entries
22-
private final static int CACHE_SIZE = 10;
21+
22+
private static final int CACHE_SIZE = 1024;
2323

2424
// the inner list holds the annotations per file, the outer collection maps this to a BibEntry.
2525
private LoadingCache<BibEntry, Map<Path, List<FileAnnotation>>> annotationCache;
2626

27-
/**
28-
* Creates an empty fil annotation cache. Required to allow the annotation cache to be injected into views without
29-
* hitting the bug https://github.com/AdamBien/afterburner.fx/issues/71 .
30-
*/
27+
/// Creates an empty file annotation cache. Required to allow the annotation cache to be injected into views without
28+
/// hitting the bug <https://github.com/AdamBien/afterburner.fx/issues/71>.
3129
public FileAnnotationCache() {
3230
}
3331

@@ -47,12 +45,12 @@ public Map<Path, List<FileAnnotation>> load(BibEntry entry) {
4745
* @return Map containing a list of annotations in a list for each file
4846
*/
4947
public Map<Path, List<FileAnnotation>> getFromCache(BibEntry entry) {
50-
LOGGER.debug("Loading Bibentry '%s' from cache.".formatted(entry.getCitationKey().orElse(entry.getId())));
48+
LOGGER.debug("Loading BibEntry {} from cache.", entry.getCitationKey().orElse(entry.getId()));
5149
return annotationCache.getUnchecked(entry);
5250
}
5351

5452
public void remove(BibEntry entry) {
55-
LOGGER.debug("Deleted Bibentry '%s' from cache.".formatted(entry.getCitationKey().orElse(entry.getId())));
53+
LOGGER.debug("Deleted BibEntry {} from cache.", entry.getCitationKey().orElse(entry.getId()));
5654
annotationCache.invalidate(entry);
5755
}
5856
}

0 commit comments

Comments
 (0)