Skip to content

Commit

Permalink
ts
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Dec 19, 2024
1 parent 5d97f0b commit d6fd380
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ export function weakMapMemoize<T extends AnyFunction>(fn: T, options?: WeakMapMe
};

// Initialize LRU Cache if maxEntries is specified
let lruCache: LRU.Cache<any, any> | null = null;
let lruCache: LRU<any, any> | null = null;

if (maxEntries) {
lruCache = new LRU<any, any>({
max: maxEntries,
dispose: (key, value) => {
dispose: (key, _value) => {
// When an entry is evicted from the LRU cache,
// traverse the cache tree and remove the cached result
const keyPath = key as any[];
let currentCache = cacheRoot;
let currentCache: CacheNode | undefined = cacheRoot;

for (let i = 0; i < keyPath.length; i++) {
const arg = keyPath[i];
Expand Down

0 comments on commit d6fd380

Please sign in to comment.