# @zcorky/lru

> A tiny and fast Leat Recently Used(LRU) cache, written by typescript

Latest version **1.0.5** (published 2020-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zcorky/lru
pnpm add @zcorky/lru
yarn add @zcorky/lru
bun add @zcorky/lru
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-12-22 |
| First published | 2018-09-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zero |
| Maintainers | uniquecolesmith |
| Keywords | zcorky, lru, cache, memoryCache, redis, ylru, flru, typescript |

## Links

- npm: https://www.npmjs.com/package/@zcorky/lru
- Repository: https://github.com/zcorky/lru
- Issues: https://github.com/zcorky/lru/issues
- npm.io page: https://npm.io/package/@zcorky/lru

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2020-12-22
- 1.0.4 — 2020-12-21
- 1.0.3 — 2019-01-10
- 1.0.2 — 2018-12-02
- 1.0.1 — 2018-09-11
- 1.0.0 — 2018-09-10

## README

# lru

[![NPM version](https://img.shields.io/npm/v/@zcorky/lru.svg?style=flat)](https://www.npmjs.com/package/@zcorky/lru)
[![NPM quality](http://npm.packagequality.com/shield/%40zcorky%2Flru.svg)](http://packagequality.com/#?package=@zcorky/lru)
[![Coverage Status](https://codecov.io/gh/zcorky/lru/branch/master/graph/badge.svg)](https://codecov.io/gh/zcorky/lru)
[![Dependencies](https://img.shields.io/david/zcorky/lru.svg?style=flat-square)](https://david-dm.org/zcorky/lru)
[![Build Status](https://travis-ci.com/zcorky/lru.svg?branch=master)](https://travis-ci.com/zcorky/lru)
[![Known Vulnerabilities](https://snyk.io/test/npm/@zcorky/lru/badge.svg?style=flat-square)](https://snyk.io/test/npm/@zcorky/lru)
[![NPM download](https://img.shields.io/npm/dm/@zcorky/lru.svg?style=flat-square)](https://www.npmjs.com/package/@zcorky/lru)
![license](https://img.shields.io/github/license/zcorky/lru.svg)
[![issues](https://img.shields.io/github/issues/zcorky/lru.svg)](https://github.com/zcorky/lru/issues)

> A tiny and fast Leat Recently Used(LRU) cache, written by typescript.
> Supports "expire" and "hits".

## Install

```
$ npm install @zcorky/lru
```


## Usage

```js
const LRU = require('@zcorky/lru').lru;
// import LRU from '@zcorky/lru'; // ts or es6

const lru = new LRU(100);
lru.set(key, value);
lru.get(key);

// value2 will be expired after 5000ms
lru.set(key2, value2, { maxAge: 5000 });
// get key and update expired
lru.get(key2, { maxAge: 5000 });

// hits
lru.hits(); // { count, rate }
```

### Relative Reposities
* [ylru](https://github.com/node-modules/ylru): Add "expire", "allow set empty value" extends on hashlru.
* [flru](https://github.com/lukeed/flru): A tiny (215B) and fast Least Recently Used (LRU) cache.

## License

MIT © [Moeover](https://moeover.com)

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