map-cache
Advanced tools
Weekly downloads
Readme
Basic cache object for storing key-value pairs.
Install with npm:
$ npm install map-cache --save
Based on MapCache in Lo-dash v3.0. MIT License
var MapCache = require('map-cache');
var mapCache = new MapCache();
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 the Cache
object for chaining.Example
cache.set('foo', 'bar');
Gets the cached value for key
.
Params
key
{String}: The key of the value to get.returns
{any}: Returns the cached value.Example
cache.get('foo');
//=> 'bar'
Checks if a cached value for key
exists.
Params
key
{String}: The key of the entry to check.returns
{Boolean}: Returns true
if an entry for key
exists, else false
.Example
cache.has('foo');
//=> true
Removes key
and its value from the cache.
Params
key
{String}: The key of the value to remove.returns
{Boolean}: Returns true
if the entry was removed successfully, else false
.Example
cache.del('foo');
You might also be interested in these projects:
get
, set
, del
, and has
methods for node.js/javascript projects. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on May 10, 2016.
Basic cache object for storing key-value pairs.
The npm package map-cache receives a total of 10,684,363 weekly downloads. As such, map-cache popularity was classified as popular.
We found that map-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.