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

lru-cache-ext

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-cache-ext

Thin wrapper around lru-cache with extended functionality.

  • 1.1.11
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

lru-cache-ext

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Thin wrapper around lru-cache with extended functionality.

Install

Install with npm:

$ npm install --save lru-cache-ext

Usage

Please refer to lru-cache.

Additions

Some additional, non-invasive functionality is added.

memoize(key: String, valueFn: function)

Only when the key is not present in cache (or has expired), valueFn is called and placed into cache.

The cached value is returned when it becomes available (important in the case where valueFn is async).

The cache is left empty if an error is thrown at any point in valueFn (even asynchronous).

Useful when multiple async operation need to access the same async information.

memoizeSync(key: String, valueFn: function)

Similar to "memoize", when key is not present (or has expired), valueFn is called and placed into the cache.

Cached value is returned from the function.

valueFn can be a synchronous or asynchronous function.

If valueFn is an asynchronous function and an error is thrown asynchronously, the cache is not invalidated.

Keywords

FAQs

Package last updated on 20 May 2020

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