# cache-entity

> Cache remote resources in a key-value store

Latest version **1.0.1** (published 2020-06-04) · ISC license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2020-06-04 |
| First published | 2020-06-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Eduard Castellano |
| Maintainers | educastellano |

## Links

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

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [template-format](https://npm.io/package/template-format.md) ^1.2.5

## Recent versions

- 1.0.1 (latest) — 2020-06-04
- 1.0.0 — 2020-06-04

## README

# Cache Entity

Cache remote resources in a key-value store

# Install

    npm install cache-entity

# Usage


```js
    import CacheEntity from 'cache-entity'

    // Init
    const cache = new CacheEntity({
        users: 'https://jsonplaceholder.typicode.com/users/{key}',
        todos: 'https://jsonplaceholder.typicode.com/todos/{key}',
    })

    // Add data 
    cache.add('todos', { 1: { name: 'Buy apples' }, 2: { name: 'Fix bugs' } })

    // Lookup 
    const todo1 = await cache.lookup('todos', 1) // will not fetch
    const todo2 = await cache.lookup('todos', 3) // will fetch
    const todo3 = await cache.lookup('todos', 3) // will not fetch
    
```

## Changelog

* 1.0.0 
    * Initial release :tada:

## License

[ISC License](http://opensource.org/licenses/ISC)

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