map-cache
Basic cache object for storing key-value pairs.
Install
Install with npm:
$ npm install map-cache --saveBased on MapCache in Lo-dash v3.0. MIT License
Usage
var MapCache = require('map-cache');
var mapCache = new MapCache();API
Creates a cache object to store key/value pairs.
Example
var cache = new MapCache();Adds value to key on the cache.
Params
key{String}: The key of the value to cache.value{any}: The value to cache.returns{Object}: Returns theCacheobject for chaining.
Example
Gets the cached value for key.
Params
key{String}: The key of the value to get.returns{any}: Returns the cached value.
Example
Checks if a cached value for key exists.
Params
key{String}: The key of the entry to check.returns{Boolean}: Returnstrueif an entry forkeyexists, elsefalse.
Example
Removes key and its value from the cache.
Params
key{String}: The key of the value to remove.returns{Boolean}: Returnstrueif the entry was removed successfully, elsefalse.
Example
Related projects
You might also be interested in these projects:
cache-base: Basic object cache with
get,set,del, andhasmethods for node.js/javascript projects. | homepageconfig-cache: General purpose JavaScript object storage methods. | homepage
option-cache: Simple API for managing options in JavaScript applications. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
Or, if verb is installed globally:
Running tests
Install dev dependencies:
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on May 10, 2016.
Last updated
Was this helpful?