Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.
/ map-expire Public archive
forked from cavitkeskin/map-expire

A JavaScript map with entries that expire after a given number of seconds.

Notifications You must be signed in to change notification settings

cityssm/map-expire

 
 

Repository files navigation

map-expire

npm Codacy Badge Maintainability Test Coverage AppVeyor Snyk Vulnerabilities for GitHub Repo

A JavaScript map with entries that expire after a given number of milliseconds.

Based on the work in cavitkeskin/map-expire.

Installation

npm install @cityssm/map-expire

Usage

import { Cache } from "@cityssm/map-expire";
const cache = new Cache();

cache.set(key, value, expiryMillis);

const value = cache.get(key);

Methods

set(key, value, expiryMillis)

  • If expiryMillis is falsy or not given, the value will never be expired.

get(key)

  • Returns undefined if not exists or expired.

About

A JavaScript map with entries that expire after a given number of seconds.

Topics

Resources

Stars

Watchers

Forks

Languages

  • JavaScript 60.1%
  • TypeScript 39.9%