# rduk-cache

> cache provider

Latest version **1.0.0** (published 2017-10-22) · MIT license · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2017-10-22 |
| First published | 2017-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kim Ung |
| Maintainers | khuang |
| Keywords | cache, provider |

## Links

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

## Dependencies (3)

- [rduk-errors](https://npm.io/package/rduk-errors.md) 1.2.3
- [rduk-provider](https://npm.io/package/rduk-provider.md) 0.1.3
- [rduk-configuration](https://npm.io/package/rduk-configuration.md) 1.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

- 1.0.0 (latest) — 2017-10-22
- 0.0.6 — 2017-10-21
- 0.0.5 — 2017-10-21
- 0.0.4 — 2017-10-21
- 0.0.3 — 2017-10-20
- 0.0.2 — 2017-10-20
- 0.0.1 — 2017-10-20

## README

# RDUK - Cache

[![Build Status](https://travis-ci.org/rd-uk/rduk-cache.svg?branch=master)](https://travis-ci.org/rd-uk/rduk-provider)
[![Coverage Status](https://coveralls.io/repos/github/rd-uk/rduk-cache/badge.svg?branch=master)](https://coveralls.io/github/rd-uk/rduk-provider?branch=master)

Manage cache in your Node.js app

## Installation

```
# install rduk-cache module
npm install rduk-cache --save --save-exact

# install rduk-cache store (here redis)
npm install rduk-cache-store-redis --save --save-exact
```

### Cache Store implementations

- [redis](https://github.com/rd-uk/rduk-cache-store-redis)

### How to use

#### cache store configuration

1. Add a `config.yml` file to your app ([more information](https://github.com/rd-uk/rduk-configuration))
1. Add a `cacheStore` section (see below for redis configuration)

```yaml
---
cacheStore:
    name: redis
    providers:
        -
            name: redis
            type: rduk-cache-store-redis
            url: redis://...

```

```js
var cache = require('rduk-cache');
```

#### Promise set(key, value)

```js
cache.set('key', {
    prop1: 'value 1',
    prop2: 'value 2'
})
```

#### Promise get(key)

```js
cache.get('key')
    .then(function(obj) {
        console.log(obj.prop1); // output: 'value 1'
    });
```

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