# node-big-cache

> File based cache for large data. Data is stored in different files with different keys in a single folder.

Latest version **0.0.3** (published 2019-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-big-cache
pnpm add node-big-cache
yarn add node-big-cache
bun add node-big-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.3 |
| Published | 2019-01-28 |
| First published | 2019-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 8.x |
| Dependencies | 3 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | rehmat |
| Keywords | node, big, large, cache, file, folder |

## Links

- npm: https://www.npmjs.com/package/node-big-cache
- Repository: https://github.com/animatedcreativity/node-big-cache
- Homepage: https://github.com/animatedcreativity/node-big-cache#readme
- Issues: https://github.com/animatedcreativity/node-big-cache/issues
- npm.io page: https://npm.io/package/node-big-cache

## Dependencies (3)

- [random-key](https://npm.io/package/random-key.md) ^0.3.2
- [node-file-json](https://npm.io/package/node-file-json.md) ^0.0.8
- [node-sanitize-options](https://npm.io/package/node-sanitize-options.md) ^0.0.4

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

- 0.0.3 (latest) — 2019-01-28
- 0.0.2 — 2019-01-28
- 0.0.1 — 2019-01-28

## README

# node-big-cache
File based cache for large data. Data is stored in different files with different keys in a single folder.

-----------------------------------------------------

**Usage:**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
```

config:
```
{
  folder: "node-big-cache",
  jsonFile: "node-big-cache-json",
  cacheTime: 3600000 // milliseconds, default 1 hour
}
```
- folder: location of cache files. File name is created using a random key and extension is `.txt`. File key/name is always random and different than data key.
- jsonFile: JSON database which stores all the matches of data key with file key. `.json` is added to the file automatically.

------------------------------------------

**Example (set):**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
var cacheTime = 60000; // milliseconds, 60 seconds
cache.set("my_special_key", "This is some long data.", cacheTime);
```

Sets data for a key. Data is saved in utf-8 format and can be extremely long. If no cache time provided then default is used.

**Example (get):**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
var data = cache.get("my_special_key");
console.log(data);
```

Gets data for a key until it expires. Data is read in utf-8 format.

**Example (list):**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
var list = cache.list();
console.log(list);
```

Gets a list of all keys saved in database.

**Example (remove):**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
cache.remove("my_special_key");
```

Removes any key and its data if exists.

**Example (clear):**

```
var bigCache = require("node-big-cache");
var cache = new bigCache(config);
cache.clear();
```

Removes all the keys and their data.

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