mirror of https://github.com/fantasticit/think.git
fix: fix lru-cache
This commit is contained in:
parent
74957fe014
commit
b471045eff
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue