# ttl-cache

> Simple in-memory object cache with TTL based per-item expiry

Latest version **1.0.2** (published 2013-12-06) · CC0 license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2013-12-06 |
| First published | 2013-12-06 |
| Weekly downloads | 0 |
| License | CC0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | norganna |
| Maintainers | norganna |
| Keywords | memory, cache, ttl, expiry |

## Links

- npm: https://www.npmjs.com/package/ttl-cache
- Repository: https://github.com/norganna/node-ttl-cache
- Issues: https://github.com/norganna/node-ttl-cache/issues
- npm.io page: https://npm.io/package/ttl-cache

## 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.2 (latest) — 2013-12-06
- 1.0.1 — 2013-12-06
- 1.0.0 — 2013-12-06

## README

node-ttl-cache
==============

Simple in-memory object cache with TTL based per-item expiry

## Installation:

    npm install ttl-cache
    
## Usage:

    var Cache = require('ttl-cache'),
        cache = new Cache();
    
    old_value = cache.set(key, value); // Set a value (returns old)
    new_value = cache.get(key); // Get a value
    values = cache.mget(key1, key2); // Get multiple values at once
    cache.del(key1, key2); // Delete one or more values at once
    cache.ttl(key, 3); // Change the ttl of a value (in seconds)
    cache.flush(); // Wipe the lot

## Options:

    var cache({
            ttl: 300,       // Number of seconds to keep entries
            interval: 60    // Cleaning interval
        });

## License:

Project code is released under CC0 license:

<a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/">
<img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" />
</a>

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