Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

map-cache

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map-cache

Basic cache object for storing key-value pairs.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19M
increased by2.69%
Maintainers
1
Weekly downloads
 
Created

What is map-cache?

The map-cache npm package is a simple cache to store key-value pairs. It is particularly useful for storing the results of expensive function calls or any other calculations that you don't want to repeat unnecessarily. It's a lightweight and fast caching solution.

What are map-cache's main functionalities?

Set and Get Values

This feature allows you to store a value with a specific key and then retrieve that value using the key.

{"const MapCache = require('map-cache');
const cache = new MapCache();
cache.set('foo', 'bar');
const value = cache.get('foo');
console.log(value); // Output: 'bar'"}

Check Existence of Key

This feature allows you to check if a key exists in the cache.

{"const MapCache = require('map-cache');
const cache = new MapCache();
cache.set('foo', 'bar');
const hasKey = cache.has('foo');
console.log(hasKey); // Output: true"}

Delete a Key

This feature allows you to delete a key-value pair from the cache.

{"const MapCache = require('map-cache');
const cache = new MapCache();
cache.set('foo', 'bar');
cache.delete('foo');
const value = cache.get('foo');
console.log(value); // Output: undefined"}

Clear the Cache

This feature allows you to clear all key-value pairs stored in the cache.

{"const MapCache = require('map-cache');
const cache = new MapCache();
cache.set('foo', 'bar');
cache.clear();
const value = cache.get('foo');
console.log(value); // Output: undefined"}

Other packages similar to map-cache

Keywords

FAQs

Package last updated on 10 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc