0.2.1 • Published 3 years ago

lfu v0.2.1

Weekly downloads
18
License
-
Repository
-
Last release
3 years ago

lfu

LFU (Least Frequently Used) implementation, written in Rust provided as WebAssembly module, using a min-heap, that is, a basic vector, and a hashmap for storage of indices to keep track of cache blocks to allow for constant-time searches.

Build

$ make

Usage

$ yarn add lfu
const Lfu = require("lfu").Lfu;

const lfu = new Lfu(4);

lfu.refer("1"); // insert 1
lfu.refer("2"); // insert 2
lfu.refer("1"); // incr 1
lfu.refer("3"); // insert 3
lfu.refer("2"); // incr 2
lfu.refer("4"); // insert 4
lfu.refer("5"); // remove 3, insert 5

lfu.clear();
0.2.1

3 years ago

0.2.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1-security

6 years ago

0.0.0

6 years ago