tiny-fifo-cache
Version:
Simple FIFO cache. put and get.
46 lines (29 loc) • 989 B
Markdown
> Simple FIFO cache. put and get.
```sh
$ npm install --save tiny-fifo-cache
```
```js
var FIFOCache = require('tiny-fifo-cache');
var maxItems = 100;
var cache = new FIFOCache(maxItems);
cache.put('key', 'value');
cache.get('key'); // returns 'value'
```
Once the cache reaches its maximum size, the oldest item is removed.
```sh
npm install
npm test
```
MIT © [Andy Hume](2015)
[]: https://badge.fury.io/js/tiny-fifo-cache.svg
[]: https://npmjs.org/package/tiny-fifo-cache
[]: https://travis-ci.org/ahume/tiny-fifo-cache.svg?branch=master
[]: https://travis-ci.org/ahume/tiny-fifo-cache
[]: https://david-dm.org/ahume/tiny-fifo-cache.svg?theme=shields.io
[]: https://david-dm.org/ahume/tiny-fifo-cache