# xache

> Yet another auto expiring, max sizable cache

Latest version **1.3.0** (published 2026-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install xache
pnpm add xache
yarn add xache
bun add xache
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

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

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2026-07-15 |
| First published | 2021-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/xache
- Repository: https://github.com/mafintosh/xache
- Issues: https://github.com/mafintosh/xache/issues
- npm.io page: https://npm.io/package/xache

## Recent versions

- 1.3.0 (latest) — 2026-07-15
- 1.2.1 — 2024-02-07
- 1.2.0 — 2023-09-22
- 1.1.0 — 2022-05-23
- 1.0.0 — 2021-05-21

## README

# xache

Yet another auto expiring, max sizable cache

```
npm install xache
```

## Usage

```js
const Xache = require('xache')

const cache = new Xache({
  maxSize: 10, // at max (ish) have 10 entries
  maxAge: 100, // auto expire entries after (ish) 100ms
  createMap() {
    // optional function to create backing storage
    return new Map()
  }
})

// When maxSize is hit, the oldest entries are removed
// cache has the same api as a map

cache.set('hello', 'world')
console.log(cache.get('hello'))

console.log(...cache) // iterable!
```

That's it, nice and simple.

## License

MIT

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