# redis-wrapper

> Provides a simple class/mixin as base for when you need to wraps a redis client (or provide API that does) via a use() method

Latest version **0.1.3** (published 2013-03-06) · BSD license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2013-03-06 |
| First published | 2012-11-09 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chakrit Wichian |
| Maintainers | chakrit |

## Links

- npm: https://www.npmjs.com/package/redis-wrapper
- Repository: https://github.com/chakrit/redis-private
- npm.io page: https://npm.io/package/redis-wrapper

## Dependencies (2)

- [redis](https://npm.io/package/redis.md) ~0.8.2
- [coffee-script](https://npm.io/package/coffee-script.md) ~1.6.1

## Recent versions

- 0.1.3 (latest) — 2013-03-06
- 0.1.2 — 2012-11-12
- 0.1.1 — 2012-11-09
- 0.1.0 — 2012-11-09

## README

# REDIS-WRAPPER

Because I wrote this too many times already, I decided to just move it into a small module of its own.

### SETUP CLASS

Javascript:

```javascript
function MyRedisClass() { }
MyRedisClass.prototype = new require('redis-wrapper')()

// or mix into a singleton object with underscore
MySingleton = { func: function() { } };
MySingleton = _.extend(MySingleton, new require('redis-wrapper')());
```

Coffeescript:

```coffeescript
class YourClass extends require('redis-wrapper')
```

### USAGE

Setup your classes with `use()`

```javascript
MyClass.prototype = new require('redis-wrapper')();

var instance = new MyClass()
  , client = require('redis').createClient();

instance.use(client);
```

Adds `ensureClient()` before redis-related methods to ensure a client is set.

```javascript
MyClass.prototype.someMethod = function() {
  this.ensureClient();

  // do things with this.client
};
```

That's all.

### TODO

* Adds ability to use a url (via `redis-url`) or host/port combination.

### LICENSE

BSD

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