Skip to content

Latest commit

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

NPM versionBuild StatusDependency Status

Simple LFU cache. put and get.

Suitable for use in browsers and Node.js.

Install

$ npm install --save tiny-lfu-cache

Usage

varLFUCache=require('tiny-lfu-cache');varmaxSize=100;varcache=newLFUCache(maxSize);cache.put('key','value');cache.get('key');// returns 'value'cache.flush();// Empties the cache

LFU Eviction Policy

Once the cache reaches its maximum size, the least frequently used (LFU) item is evicted.

If items in the cache have equal frequency of use, then the least recently used (LRU) item is evicted.

Development

npm install
npm test

License

MIT © Andy Hume

About

Simple LFU cache. put and get.

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages