@cityssm/map-expire
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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.

Package Sidebar

Install

npm i @cityssm/map-expire

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

6.45 kB

Total Files

5

Last publish

Collaborators

  • dgowans