Socket
Socket
Sign inDemoInstall

map-age-cleaner

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-age-cleaner

Automatically cleanup expired items in a Map


Version published
Weekly downloads
4.5M
decreased by-1.9%
Maintainers
1
Weekly downloads
 
Created

What is map-age-cleaner?

The map-age-cleaner npm package is designed to automatically remove expired items from a Map object in JavaScript based on a specified age. This is particularly useful for managing caches or temporary data storage where items should not persist indefinitely. The package works by wrapping a standard Map object and allowing the developer to specify a maximum age for the items. Once an item exceeds this age, it is automatically removed from the Map, helping to manage memory and data relevance efficiently.

What are map-age-cleaner's main functionalities?

Automatic cleanup of expired items

This feature allows for the automatic removal of items from a Map after they have been in the Map for a specified duration. The `maxAge` option is used to define how long (in milliseconds) an item should remain in the Map before being automatically removed.

const mapAgeCleaner = require('map-age-cleaner');
const myMap = new Map();
mapAgeCleaner(myMap, { maxAge: 10000 });
// Adds an item to the map
myMap.set('key', 'value');
// After 10 seconds, the item is automatically removed

Other packages similar to map-age-cleaner

Keywords

FAQs

Package last updated on 13 Nov 2018

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