# cachelib-js

> Simple cache library with ttl

Latest version **1.0.2** (published 2023-05-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install cachelib-js
pnpm add cachelib-js
yarn add cachelib-js
bun add cachelib-js
```

## 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 | 2023-05-07 |
| First published | 2023-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | thewillwillhelp |
| Maintainers | thewillwillhelp |
| Keywords | cache, js |

## Links

- npm: https://www.npmjs.com/package/cachelib-js
- Repository: https://github.com/thewillwillhelp/cachelib
- Homepage: https://github.com/thewillwillhelp/cachelib#readme
- Issues: https://github.com/thewillwillhelp/cachelib/issues
- npm.io page: https://npm.io/package/cachelib-js

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-05-07
- 1.0.1 — 2023-05-07
- 1.0.0 — 2023-05-07

## README

JS Cache library that allows to store data and setup TTL.

Usage:

    const { CacheService } = require('cachelib-js');

    const cacheService = new CacheService;

    // subscribe to service events (SET, GET, REMOVE)
    cacheService.addListener(CacheService.events.SET, (event) => { /* response on SET event */ });

    // set value to cache which will be non-actual after 10 sec
    cacheService.set('key', { value: 'any value' }, { ttl: 10000 });

    // get value
    const result = cacheService.get('key');

    // remove value
    cacheService.remove('key');

    // extract full data
    const fullCacheData = cacheService.extract();

    // preload data to service
    cacheService.load(fullCacheData);

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