Configurable cache, based on immutable.js.
import {Cache} from 'immutable-cache';
let cache = new Cache({maxSize: 100});
// cache key 'key' with value 'value'
cache = cache.set('key', 'value');
// check if key is cached
cache.has('key'); // true
cache.has('other-key'); // false
cache.get('key'); // 'value'
cache.get('other-key'); // undefined
Name | Description |
---|---|
maxSize |
maximum number of keys stored in cache |
Immutable-Cache is freely distributable under the terms of the MIT license.