0.2.2 • Published 8 years ago

map-cache v0.2.2

Weekly downloads
16,111,606
License
MIT
Repository
github
Last release
8 years ago

map-cache NPM version NPM downloads Build Status

Basic cache object for storing key-value pairs.

Install

Install with npm:

$ npm install map-cache --save

Based on MapCache in Lo-dash v3.0. MIT License

Usage

var MapCache = require('map-cache');
var mapCache = new MapCache();

API

MapCache

Creates a cache object to store key/value pairs.

Example

var cache = new MapCache();

.set

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');

.get

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'

.has

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

.del

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');

Related projects

You might also be interested in these projects:

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:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

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.

snapdragonfragment-cacheparse-filepatharchetype-librarycomponennenttvuedragdropuploadimages@jdutchak/argosidpopsmart-common-authreact-native-bluetooth2killi8n-react-native-fast-imagern-send-smsspecify-importsbabel-specify-imports@icanpm/api-mastergew-nodejs-api-client@arisageha/react-lazyload@arisageha/react-lazyload-fix@cashremit/cr-streamline-iconsreact-native-template-rfbasecloud-archive-s3airscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxf@phil8795/pecuniarius-apideneme323112@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_modbitgetreact-native-thanh-toast-library@thanhnguyen14797/react-native-thanh-toast-library@l1nyanm1ng/react-picture-viewercthpb-plugin-socialpanqibaoreact-native-printer-brothersrn-pdf-reader-offlinereact-native-shekhar-bridge-testsnapdragon-updatedwilscanner@oiti/documentoscopy-react-native@abaxx/a-idjs4cytoscape@mink-opn/build-tokensquoc-testreact-native-slider-kf@prodam/prodam-types@saaspe/componentsplginexpand-react-bridge@everything-registry/sub-chunk-2128@d-protocol/d-libondowt-client-javascriptoriginparvan_componentsparvan_reactjs_componentspayutestingplugin_test01peter.you.jqweui.test.publishplaykit-js-hls-sondqo2oprotocolpolen-web-components-reactprebeneide-first-npm-packagepublishing-to-npm-packageqa_hdd@devorso/dcountdown@donapot/mylibtestvue-size-trackerwc-starterkitvue-button-test1webchezylyuxuan-myvue-cli@deep27/supersetpluginchart-helloworld@geeky-apo/react-native-advanced-clipboardwifi_configuration_packagewarmaitech-gpt-3-encoderu-libraryxdms3vue-v3-yandex-metrikavue-dev-clonevue-compmentvideo-multi-uploader@hemith/react-native-tnkcordova-plugin-newplugin@maricode1111/date-lib@marinaga/bananize@mariomui/cansfmslfn-lib-examplefishzero@massivepixel/use-query3.0.0@simstudio/htmldiff
0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago