@zcorky/lru
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

lru

NPM version NPM quality Coverage Status Dependencies Build Status Known Vulnerabilities NPM download license issues

A tiny and fast Leat Recently Used(LRU) cache, written by typescript. Supports "expire" and "hits".

Install

$ npm install @zcorky/lru

Usage

const LRU = require('@zcorky/lru').lru;
// import LRU from '@zcorky/lru'; // ts or es6

const lru = new LRU(100);
lru.set(key, value);
lru.get(key);

// value2 will be expired after 5000ms
lru.set(key2, value2, { maxAge: 5000 });
// get key and update expired
lru.get(key2, { maxAge: 5000 });

// hits
lru.hits(); // { count, rate }

Relative Reposities

  • ylru: Add "expire", "allow set empty value" extends on hashlru.
  • flru: A tiny (215B) and fast Least Recently Used (LRU) cache.

License

MIT © Moeover

/@zcorky/lru/

    Package Sidebar

    Install

    npm i @zcorky/lru

    Weekly Downloads

    104

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    8.34 kB

    Total Files

    5

    Last publish

    Collaborators

    • uniquecolesmith