# @hydre/lru_set

> A basic lru set implementation

Latest version **0.1.2** (published 2022-01-12) · UNLICENSE license · 0 weekly downloads

## Install

```sh
npm install @hydre/lru_set
pnpm add @hydre/lru_set
yarn add @hydre/lru_set
bun add @hydre/lru_set
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-01-12 |
| First published | 2022-01-12 |
| Weekly downloads | 0 |
| License | UNLICENSE |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hydre |
| Maintainers | sceat, hydre-bot, deltaevo |
| Keywords | lru, set |

## Links

- npm: https://www.npmjs.com/package/@hydre/lru_set
- Repository: https://github.com/HydreIO/lru_set
- Homepage: https://hydre.io
- Issues: https://github.com/HydreIO/lru_set/issues
- npm.io page: https://npm.io/package/@hydre/lru_set

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2022-01-12

## README

# Lru_set

> Basic no-deps Lru Set implementation with timeout support

Add elements in the set and the last used will drop out of it when full.
Elements will also expire and be removed if `max_age` is specified

## 📦 Install

```
npm i @hydre/lru_set
```

## Usage

```js
import Lru from 'lru_set'

const cache = Lru({
  capacity: 5,
  max_age: 100, // if specified, ms before removing an element
  on_eviction: element => { }
})

cache.add(1)
cache.access(5) // returns weither or not an element is still present and also reset his age
```

---
_Source: https://npm.io/package/@hydre/lru_set · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
