# kor-redis

> This module is to make redis setup easy.

Latest version **1.1.1** (published 2019-07-08) · MIT license · 0 weekly downloads

## Install

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

## 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.1.1 |
| Published | 2019-07-08 |
| First published | 2018-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Razaq |
| Maintainers | razaqk |
| Keywords | redis, cli, util, cache, promise, no callback |

## Links

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

## Dependencies (1)

- [redis](https://npm.io/package/redis.md) ^2.8.0

## 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.1.1 (latest) — 2019-07-08
- 1.1.0 — 2019-07-08
- 1.0.9 — 2019-07-08
- 1.0.8 — 2018-08-22
- 1.0.6 — 2018-06-10
- 1.0.5 — 2018-05-28
- 1.0.4 — 2018-05-28
- 1.0.3 — 2018-05-27
- 1.0.2 — 2018-05-27
- 1.0.1 — 2018-05-27
- 1.0.0 — 2018-05-27

## README

The `kor-redis` library exported as ```NodeJS``` module.

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image-url]][travis-url]

# Installation

[![Greenkeeper badge](https://badges.greenkeeper.io/razaqK/kor-redis.svg)](https://greenkeeper.io/)

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```
   $ npm i npm
   $ npm i --save kor-redis
```

:rotating_light:
### New Features
- Generic command function to run any redis command

#### Features
- Get remaining expiration time if set on key
- Extend expiration time
- Remove expiration (persist the redis key)
- Rename redis key

### Usage: In NodeJS

```diff
+ Added command method that allow the use of all redis commands.

// Load pmodule
const Redis = require('kor-redis');
const redis = new Redis('host', 'port', 'db');

redis.command('set', ['key', 'value']);
```

See Redis Commands here [Redis.io](https://redis.io/commands)

```
// Load pmodule
const Redis = require('kor-redis');
const redis = new Redis('host', 'port', 'db');

// setting value. Note value can be an object, an array, string or number
redis.set(key, value)

// setting value and expiring time. Note value can be an object, an array, string or number
redis.set(key, value, 5) // this expires in 5s

// get value store in redis
redis.get(key).then(value => {
    console.log(value)
})

// get all keys in redis
redis.getKeys().then(keys => {
    console.log(keys)
})

// delete key in redis
redis.del(key)

// delete all keys in redis
redis.delAll()

// set new (if no expiration time) or increase the expiration time on a key 
redis.setExpiryTime(key, 5).then(res => {
    console.log(res)
})

// check the remain expiration on a key
redis.remainExpiryTimeInSeconds(key).then(res => {
    console.log(res)
})

// remove expiration from a key
redis.persist(key).then(res => {
    console.log(res)
})

// rename a redis key to new one
redis.renameKey(key, newKey).then(res => {
    console.log(res)
})
```

See the [package source](https://github.com/razaqK/kor-redis) for more detail.

[npm-image]: https://img.shields.io/npm/v/kor-redis.svg
[npm-url]: https://npmjs.org/package/kor-redis
[downloads-image]: https://img.shields.io/npm/dm/kor-redis.svg
[downloads-url]: https://npmjs.org/package/kor-redis
[travis-url]: https://travis-ci.org/razaqK/kor-redis
[travis-image-url]: https://travis-ci.org/razaqK/kor-redis.svg?branch=master

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