1.0.0 • Published 7 years ago
modest-lru v1.0.0
About
Simple little LRU cache that works in node & browser. Based on the hashlru algorithm. Uses Maps under the hood.
Install
$ npm install modest-lru
# OR
$ yarn add modest-lru
Usage
const ModestLRU = require('modest-lru')
const lru = new ModestLRU(50) // Max size of 50
const foo = 'foo'
const baz = function baz() {}
lru.set(foo, 5)
lru.set(baz, 60)
lru.get(foo) // 5
lru.get(baz) // 60
lru.has(baz) // true
lru.has(6) // false
lru.remove(baz) // Remove key baz from cache
lru.clear() // Clear the cache
Contributing
Contributions are welcome!
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Or open up a issue.
License
Licensed under the MIT License.
1.0.0
7 years ago