wireapp/lru-ts

Name: lru-ts

Owner: Wire Swiss GmbH

Description: LRU cache in TypeScript, adapted from https://github.com/rsms/js-lru

Forked from: TrueLink/lru-ts

Created: 2016-10-28 11:35:47.0

Updated: 2017-10-07 16:31:59.0

Pushed: 2017-02-09 14:24:33.0

Homepage: null

Size: 38

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

:warning: Deprecation Notice :warning:

This module is deprecated. Please use wire-webapp-lru-cache.

lru-ts

LRU cache in TypeScript, adapted from https://github.com/TrueLink/lru-ts

Builds
Browser

Node.js
--p tsconfig.node.json
Usage
TypeScript
rt LRUCache from "lru-ts";



cache: LRUCache = new LRUCache(123);
Example
c = new LRUCache(3);
t('adam', 29);
t('john', 26);
t('angela', 24);
String();        // -> "adam:29 < john:26 < angela:24"
t('john');       // -> 26
ow 'john' is the most recently used entry, since we just requested it
String();        // -> "adam:29 < angela:24 < john:26"
t('zorro', 141); // -> {key:adam, value:29}
ecause we only have room for 3 entries, put-ing 'zorro' purged 'adam'
String();        // -> "angela:24 < john:26 < zorro:141"

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.