fix: fix lru-cache

This commit is contained in:
fantasticit 2022-05-10 11:16:49 +08:00
parent 74957fe014
commit b471045eff
1 changed files with 0 additions and 8 deletions

View File

@ -114,15 +114,9 @@ export class LRUCache {
} }
} }
const CacheMap = new Map();
export const createKeysLocalStorageLRUCache = (storageKey, capacity) => { export const createKeysLocalStorageLRUCache = (storageKey, capacity) => {
const lruCache = new LRUCache(capacity); const lruCache = new LRUCache(capacity);
if (CacheMap.has(storageKey)) {
return CacheMap.get(setStorage);
}
const manager = { const manager = {
syncFromStorage() { syncFromStorage() {
const data = getStorage(storageKey) || []; const data = getStorage(storageKey) || [];
@ -145,7 +139,5 @@ export const createKeysLocalStorageLRUCache = (storageKey, capacity) => {
}, },
}; };
CacheMap.set(storageKey, manager);
return manager; return manager;
}; };