fix: packet send/recv

This commit is contained in:
手瓜一十雪
2024-10-12 19:51:29 +08:00
parent bb8b06c044
commit cdd00d665d
4 changed files with 31 additions and 25 deletions

View File

@@ -24,7 +24,9 @@ export class LRUCache<K, V> {
} else if (this.cache.size >= this.capacity) {
// If the cache is full, remove the least recently used key (the first one in the map)
const firstKey = this.cache.keys().next().value;
this.cache.delete(firstKey);
if (firstKey !== undefined) {
this.cache.delete(firstKey);
}
}
this.cache.set(key, value);
}