# ttl-lru-cache

> A fast in memory cache with TTL and LRU support

Latest version **0.0.2** (published 2012-07-05) · 0 weekly downloads

## Install

```sh
npm install ttl-lru-cache
pnpm add ttl-lru-cache
yarn add ttl-lru-cache
bun add ttl-lru-cache
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2012-07-05 |
| First published | 2012-07-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Paul Serby |
| Maintainers | serby |

## Links

- npm: https://www.npmjs.com/package/ttl-lru-cache
- Repository: git@github.com:serby/ttl-lru-cache
- npm.io page: https://npm.io/package/ttl-lru-cache

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) *

## Recent versions

- 0.0.2 (latest) — 2012-07-05
- 0.0.1 — 2012-07-03

## README

# ttl-lru-cache - A fast in memory cache with TTL and LRU support

[![build status](https://secure.travis-ci.org/serby/ttl-lru-cache.png)](http://travis-ci.org/serby/ttl-lru-cache)

## Installation

      npm install ttl-lru-cache

## Usage

```js

var cache = require('ttl-lru-cache')({ maxLength: 100 });

cache.set('a', 'Hello');

var a = cache.get('a');

// a = 'Hello'

// TTL Example
cache.set('b', 'Hello', 1000); // Add TTL in ms
var b = cache.get('b');
// b = 'Hello'

setTimeout(function() {
  var b = cache.get('b');
// b = undefined
}, 2000);

```

## Benchmark against lru-cache

      npm install
      make bench

## Credits
[Paul Serby](https://github.com/serby/) follow me on twitter [@serby](http://twitter.com/serby)

## Licence
Licenced under the [New BSD License](http://opensource.org/licenses/bsd-license.php)

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