Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 17, 2024 via pnpm

lru-cache 6.0.0

A cache object that deletes the least-recently-used items.
Package summary
Share
0
issues
1
license
2
ISC
Package created
16 Jul 2011
Version published
11 Jul 2020
Maintainers
1
Total deps
2
Direct deps
1
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
lru-cache@6.0.0
yallist@4.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of lru-cache 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
yallist4.0.04.39 kBISC
prod

Visualizations

Frequently Asked Questions

What does lru-cache do?

The "lru-cache" is a node package that provides a JavaScript implementation of a Least Recently Used (LRU) cache. An LRU cache deletes the least recently used items to make space for recently used items. You can specify a maximum number of the most recently used items, beyond which the least recently used items get deleted. Although primarily not a TTL cache, you can also set a Time to Live (TTL) on the cache or on a single "set" operation. As of version 7, "lru-cache" is noted as being one of the most performant JavaScript LRU cache implementations available. The library supports a wide variety of use cases, though utilizing some features may affect performance by increasing the workload of the cache.

How do you use lru-cache?

To use the "lru-cache" package in your JavaScript project, you first need to install it via npm by running npm install lru-cache --save in your terminal. Once installed, the "lru-cache" can be utilized by importing it into your JavaScript file. Here's an example of a minimal usage scenario:

const { LRUCache } = require('lru-cache');

const options = {
  max: 500,
  ttl: 1000 * 60 * 5, // 5 minutes in milliseconds
};

const cache = new LRUCache(options);

cache.set('key', 'value'); // set a value
console.log(cache.get('key')); // retrieve the value
cache.delete('key'); // delete value
cache.clear(); // empty the cache

The "lru-cache" module allows the use of non-string keys and setting of various options. For example, max storage limit, disposal mechanism for evicted objects, TTL, and setting asynchronous methods for cache.fetch() function.

Where are the lru-cache docs?

The documentation for the "lru-cache" is available on the GitHub repository of the package, under this URL: git://github.com/isaacs/node-lru-cache.git. The readme file in the main directory of the repository provides all the necessary information on how to install and use the package, as well as detailed descriptions of its features and options.