Skip to content
/ lfu-wasm Public

LFU (Least Frequently Used) implementation, written in Rust provided as WebAssembly module.

Notifications You must be signed in to change notification settings

styla/lfu-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

LFU (Least Frequently Used) implementation, written in Rust provided as WebAssembly module.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published