package lru
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Module LruSource
Scalable LRU caches
Lru provides size-bounded finite maps that remove the least-recently-used (LRU) bindings in order to maintain the size constraint. Two implementations are provided: one is functional, the other imperative.
The functional map is backed by a priority search queue. Operations on individual elements are O(log n).
The mutable map is backed by the standard Hashtbl paired with a doubly-linked list. Operations on individual elements incur an O(1) overhead on top of hash table access.
Both versions support differentially weighted bindings, and have a capacity parameter that limits the combined weight of the bindings. To limit the maps by the number of bindings, use let weight _ = 1.
v0.1.1 — homepage
Lru
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page