Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

matterway/immutable-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Immutable Cache

Configurable cache, based on immutable.js.

Example

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

Options

Name Description
maxSize maximum number of keys stored in cache

License

Immutable-Cache is freely distributable under the terms of the MIT license.