Socket
Socket
Sign inDemoInstall

@digitalcredentials/lru-memoize

Package Overview
Dependencies
Maintainers
7
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digitalcredentials/lru-memoize

LRU Memoize


Version published
Weekly downloads
172
decreased by-26.81%
Maintainers
7
Weekly downloads
 
Created
Source

LRU-Memoize (@digitalcredentials/lru-memoize)

Node.js CI NPM Version

A Memoized wrapper around the javascript lru-cache library.

Table of Contents

Background

(Forked from digitalbazaar/lru-memoize v2.0.0 to provide TypeScript and ReactNative compatibility.)

lru-memoize is used to to memoize promises (as opposed to just the results of the operations), which helps in high-concurrency use cases. (And in turn, it uses lru-cache under the hood.)

The memoized LruCache constructor passes any options given to it through to the lru-cache constructor, so see that repo for the full list of cache management options. Commonly used ones include:

  • max (default: 100) - maximum size of the cache.
  • maxAge (default: 5 sec/5000 ms) - maximum age of an item in ms.
  • updateAgeOnGet (default: false) - When using time-expiring entries with maxAge, setting this to true will make each entry's effective time update to the current time whenever it is retrieved from cache, thereby extending the expiration date of the entry.

Install

To install locally (for development):

git clone https://github.com/digitalcredentials/lru-memoize.git
cd lru-memoize
npm install

Contribute

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

License

  • MIT License - DCC - TypeScript compatibility.
  • New BSD License (3-clause) © 2020-2021 Digital Bazaar - Initial implementation.

Keywords

FAQs

Package last updated on 30 Sep 2021

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