JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17021546
  • Score
    100M100P100Q223796F
  • License

Basic cache object for storing key-value pairs.

Package Exports

  • map-cache

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (map-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

map-cache NPM version Build Status

Basic cache object for storing key-value pairs.

Based on MapCache in Lo-dash v3.0.

Install with npm

npm i map-cache --save

Usage

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

API

MapCache

Creates a cache object to store key/value pairs.

var cache = new MapCache();

.set

Adds value to key on the cache.

  • key {String}: The key of the value to cache.
  • value {*}: The value to cache.
  • returns {Object}: Returns the Cache object for chaining.
cache.set('foo', 'bar');

.get

Gets the cached value for key.

  • key {String}: The key of the value to get.
  • returns {*}: Returns the cached value.
cache.get('foo');
//=> 'bar'

.has

Checks if a cached value for key exists.

  • key {String}: The key of the entry to check.
  • returns {Boolean}: Returns true if an entry for key exists, else false.
cache.has('foo');
//=> true

.delete

Removes key and its value from the cache.

  • key {String}: The key of the value to remove.
  • returns {Boolean}: Returns true if the entry was removed successfully, else false.
cache.delete('foo');

Run tests

Install dev dependencies.

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Based on MapCache in Lo-dash v3.0. MIT License Released under the MIT license


This file was generated by verb-cli on March 18, 2015.