Skip to content

Commit d39d4e4

Browse files
author
AnthonyMalRivett
committed
Feedback Fixes
1 parent 9106dab commit d39d4e4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

frontend/src/stores/papers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { defineStore } from 'pinia';
22
import { fetchPaperPdf } from '@/services/papers';
33

4+
const MAX_PDF_CACHE_SIZE = 40;
5+
46
export const usePaperStore = defineStore('paper', () => {
57
// module-scoped cache (shared across all store instances)
68
const pdfCache = new Map<number, Blob>();
@@ -15,7 +17,7 @@ export const usePaperStore = defineStore('paper', () => {
1517
}
1618

1719
// enforce a max cache size using a simple LRU eviction strategy
18-
if (pdfCache.size >= 40) {
20+
if (pdfCache.size >= MAX_PDF_CACHE_SIZE) {
1921
const oldestKey = pdfCache.keys().next().value as number | undefined;
2022
if (oldestKey !== undefined) {
2123
pdfCache.delete(oldestKey);

0 commit comments

Comments
 (0)