# think-redis-cluster

> think-redis-cluster for ThinkJS

Latest version **1.0.8** (published 2023-07-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install think-redis-cluster
pnpm add think-redis-cluster
yarn add think-redis-cluster
bun add think-redis-cluster
```

## 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 | 2023-07-14 |
| First published | 2023-03-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | feeloc |
| Maintainers | feeloc |

## Links

- npm: https://www.npmjs.com/package/think-redis-cluster
- npm.io page: https://npm.io/package/think-redis-cluster

## Dependencies (3)

- [ioredis](https://npm.io/package/ioredis.md) ^4.19.2
- [think-helper](https://npm.io/package/think-helper.md) ^1.0.4
- [think-debounce](https://npm.io/package/think-debounce.md) ^1.0.3

## Recent versions

- 1.0.8 (latest) — 2023-07-14
- 1.0.7 — 2023-07-14
- 1.0.6 — 2023-07-07
- 1.0.4 — 2023-03-14

## README

# think-redis
[![Build Status](https://travis-ci.org/thinkjs/think-redis.svg?branch=master)](https://travis-ci.org/thinkjs/think-redis)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-redis/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-redis?branch=master)
[![npm](https://img.shields.io/npm/v/think-redis.svg?style=flat-square)](https://www.npmjs.com/package/think-redis)


## Install

```
npm install think-redis-cluster
```

## How to Use

### default options

You can find all the config options at https://github.com/luin/ioredis/blob/master/lib/redis.js

```js
const defaultConfig = {
  port: 6379,          // Redis port
  host: '127.0.0.1',   // Redis host
  password: '',
};
```

### usage

```js
import Redis from '../index';

let redisInst = new Redis(config);

// set key
let s1 = await redisInst.set('name2', 'lushijie'); // never expire
let s2 = await redisInst.set('name3', 'lushijie', 3000); // milliseconds
let s3 = await redisInst.set('name4', 'lushijie', 'EX', 5); //seconds
let s4 = await redisInst.set('name5', 'lushijie', 'PX', 10000); //milliseconds

// get key's value
let g1 = await redisInst.get('name2');

// delete key
let d1 = await redisInst.delete(key);

// add event listener, supported events see at https://github.com/luin/ioredis
redisInst.on('connect', function() {
  // todo
});

// increase 1, if key not exist, set key's value eq 0 and then increase 1
await redisInst.increase(key);

// decrease 1, if key not exist, set key's value eq 0 then decrease 1
await redisInst.decrease(key);

```

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