Simple TTL cache. put and get.
Suitable for use in browsers and Node.js.
Install
$ npm install --save tiny-ttl-cache
Usage
var TTLCache = ; var maxSize = 100;var timeToLive = 10 * 1000; // 10s in ms var cache = maxSize timeToLive;cache;cache; // returns 'value' // 10 seconds latercache; // returns null cache; // Empties the cache
TTL Eviction Policy
Once the cache reaches its maximum size, the item with the shortest TTL is removed.
Development
npm installnpm test
License
MIT © Andy Hume