Skip to content
Elliot Hesp edited this page Jul 28, 2016 · 4 revisions

This tutorial does not assume any framework or specific setup.

Installation

Install using NPM:

npm install redibox --save

Import into your project:

import RB from 'redibox';

Create a RediBox instance

You'll now want to create a single instance of RediBox, usually during or before your application bootstrap process.

const RediBox = new RB();

Check out the configuration page for a full list of options.

Listening for RediBox events

Using the RediBox instance, you're now able to listen for the broadcasted events ready & error.

ready

Fired after a successful Redis connection and once all RediBox Hooks have been loaded.

RediBox.on('ready' () => {
    console.log('Redis is connected');
});

error

Fired if the connection to Redis fails or any Hooks fail to load.

RediBox.on('ready' error => {
    console.error('RediBox failed to load', error);
});

Configuration

Clone this wiki locally