cached fetcher delete key

This commit is contained in:
k00b 2024-10-16 11:25:31 -05:00
parent 1645c2aabf
commit 1d3ab23ec4
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ class LRUCache {
return value return value
} }
delete (key) {
this.cache.delete(key)
}
set (key, value) { set (key, value) {
if (this.cache.has(key)) this.cache.delete(key) if (this.cache.has(key)) this.cache.delete(key)
else if (this.cache.size >= this.maxSize) { else if (this.cache.size >= this.maxSize) {