Open gamazeps opened 7 years ago
Push are O(1) operations whereas shift are O(n) operations, this removes this complexity.
Also returns a null as the comment says
@gamazeps,
With LRU we want most recent entry at the top of a cache (at 0, so it's searched first), that's why unshift.
unshift
null might be a valid return value we want to cache, undefined suits better.
null
undefined
Push are O(1) operations whereas shift are O(n) operations, this removes this complexity.
Also returns a null as the comment says