We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba8b64b commit bfcb9a1Copy full SHA for bfcb9a1
src/reactor/cache.js
@@ -140,12 +140,12 @@ export class LRUCache {
140
* @return {LRUCache}
141
*/
142
hit(item) {
143
- // if item exists, remove it first to reorder in lru OrderedSet
144
- const lru = this.cache.lookup(item) ?
145
- this.lru.remove(item).add(item) :
146
- this.lru;
+ if (!this.cache.has(item)) {
+ return this;
+ }
147
148
- return new LRUCache(this.limit, this.cache, lru)
+ // remove it first to reorder in lru OrderedSet
+ return new LRUCache(this.limit, this.cache, this.lru.remove(item).add(item))
149
}
150
151
/**
0 commit comments