A cache-like structure optimized for small-range integer keys, including negatives.
Internally implemented using two sparse arrays: one for non-negative keys, and one for negative keys (stored by index -key - 1).
-key - 1
get
set
delete
has
clear
const cache = new SmallIntCache<string>();cache.set(-2, 'A');cache.set(3, 'B');console.log(cache.get(-2)); // 'A' Copy
const cache = new SmallIntCache<string>();cache.set(-2, 'A');cache.set(3, 'B');console.log(cache.get(-2)); // 'A'
A cache-like structure optimized for small-range integer keys, including negatives.
Internally implemented using two sparse arrays: one for non-negative keys, and one for negative keys (stored by index
-key - 1).Remarks
get,set,delete,hasandclearExample
Deprecated