# redis-provider

> Provides simple redis usage

Latest version **1.0.8** (published 2021-07-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install redis-provider
pnpm add redis-provider
yarn add redis-provider
bun add redis-provider
```

## 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.8 |
| Published | 2021-07-24 |
| First published | 2021-07-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | guylev008 |

## Links

- npm: https://www.npmjs.com/package/redis-provider
- Repository: https://github.com/guylev008/redis-provider
- Homepage: https://github.com/guylev008/redis-provider#readme
- Issues: https://github.com/guylev008/redis-provider/issues
- npm.io page: https://npm.io/package/redis-provider

## Dependencies (3)

- [redis](https://npm.io/package/redis.md) ^3.1.2
- [bluebird](https://npm.io/package/bluebird.md) ^3.7.2
- [redislock](https://npm.io/package/redislock.md) ^1.3.0

## Recent versions

- 1.0.8 (latest) — 2021-07-24
- 1.0.7 — 2021-07-24
- 1.0.6 — 2021-07-24
- 1.0.5 — 2021-07-24
- 1.0.4 — 2021-07-24
- 1.0.3 — 2021-07-24
- 1.0.2 — 2021-07-24
- 1.0.1 — 2021-07-24
- 1.0.0 — 2021-07-23

## README

# redis-provider

Also see: https://github.com/guylev008/redis-provider

# Install

```bash
$ npm i redis-provider
```

## Usage simple example

Each DB connection have it's own name.

```jsx
const redisProvider = require('redis-provider');

const clientName = 'client';
const config = {
	clientName: clientName,
	host: 'localhost',
	port: 6379,
	password: '',
	timeout: 90000,
	retries: 10,
	delay: 100,
	dbNumber: 0
};

redisProvider.createClient(config);

await redisProvider.setAsync(clientName, 'key', 'value');
```

## Aquire Lock

aquireLockAsync needs to be provided with a lock key and a callback function that will run during the lock

```jsx
const redisProvider = require('redis-provider');

const clientName = 'client';
const config = {
	clientName: clientName,
	host: 'localhost',
	port: 6379,
	password: '',
	timeout: 90000,
	retries: 10,
	delay: 100,
	dbNumber: 0
};

redisProvider.createClient(config);

const setKey = async () => {
	await redisProvider.setAsync(clientName, 'key', 'value');
};

await redisProvider.aquireLockAsync(clientName, 'lock:key', setKey);
```

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