# cache-chunk-store

> In-memory LRU cache for abstract-chunk-store compliant stores

Latest version **3.2.2** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install cache-chunk-store
pnpm add cache-chunk-store
yarn add cache-chunk-store
bun add cache-chunk-store
```

## 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 | 3.2.2 |
| Published | 2021-05-19 |
| First published | 2015-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Feross Aboukhadijeh |
| Maintainers | mafintosh, feross |
| Keywords | abstract-chunk-store, chunk, lru, least recently used, cache, store |

## Links

- npm: https://www.npmjs.com/package/cache-chunk-store
- Repository: https://github.com/feross/cache-chunk-store
- Issues: https://github.com/feross/cache-chunk-store/issues
- Funding: https://github.com/sponsors/feross
- npm.io page: https://npm.io/package/cache-chunk-store

## Dependencies (2)

- [lru](https://npm.io/package/lru.md) ^3.1.0
- [queue-microtask](https://npm.io/package/queue-microtask.md) ^1.2.3

## 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

- 3.2.2 (latest) — 2021-05-19
- 3.2.1 — 2021-05-19
- 3.2.0 — 2021-05-19
- 3.1.1 — 2021-04-06
- 3.1.0 — 2021-04-06
- 3.0.1 — 2020-10-27
- 3.0.0 — 2018-08-04
- 2.0.0 — 2018-03-24
- 1.1.0 — 2016-02-12
- 1.0.2 — 2015-08-20
- 1.0.1 — 2015-08-15
- 1.0.0 — 2015-08-15

## README

# cache-chunk-store [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[ci-image]: https://img.shields.io/github/workflow/status/feross/cache-chunk-store/ci/master
[ci-url]: https://github.com/feross/cache-chunk-store/actions
[npm-image]: https://img.shields.io/npm/v/cache-chunk-store.svg
[npm-url]: https://npmjs.org/package/cache-chunk-store
[downloads-image]: https://img.shields.io/npm/dm/cache-chunk-store.svg
[downloads-url]: https://npmjs.org/package/cache-chunk-store
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

#### In-memory LRU (least-recently-used) cache for [abstract-chunk-store](https://github.com/mafintosh/abstract-chunk-store) compliant stores

[![abstract chunk store](https://cdn.rawgit.com/mafintosh/abstract-chunk-store/master/badge.svg)](https://github.com/mafintosh/abstract-chunk-store)

This caches the results of `store.get()` calls using
[`lru`](https://www.npmjs.com/package/lru). See the `lru` docs for the
full list of configuration options.

## Install

```
npm install cache-chunk-store
```

## Usage

``` js
const CacheChunkStore = require('cache-chunk-store')
const FSChunkStore = require('fs-chunk-store') // any chunk store will work

const store = new CacheChunkStore(new FSChunkStore(10), {
  // options are passed through to `lru-cache`
  max: 100 // maximum cache size (this is probably the only option you need)
})

store.put(0, new Buffer('abc'), err => {
  if (err) throw err

  store.get(0, (err, data) => {
    if (err) throw err
    console.log(data)

    // this will be super fast because it's cached in memory!
    store.get(0, (err, data) => {
      if (err) throw err
      console.log(data)
    })
  })
})

```

## License

MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org).

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