Redis.createManager()

Build and initialize a connection manager instance for this Redis database.

The `manager` instance returned by this method contains any configuration that is necessary for communicating with the database and establishing connections (e.g. host, user, password) as well as any other relevant metadata. The manager will often also contain a reference to some kind of native container (e.g. a connection pool). Note that a manager instance does not necessarily need to correspond with a pool though--it might simply be a container for storing config, or it might refer to multiple pools (e.g. a PoolCluster from felixge's `mysql` package).

Usage

Hover over inputs/exits for more info.

var Redis = require('machinepack-redis');


// Build and initialize a connection manager instance for this Redis database.

Redis.createManager({

connectionString: 'redis://:secret@127.0.0.1:6379/12',

onUnexpectedFailure: '->',

meta: '===',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The provided connection string is not valid for MySQL.

malformed: function (result) {

 

},

// Could not create a connection manager for this database using the specified connection string.

failed: function (result) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

connectionString required

A string containing all metadata and credentials necessary for connecting to the Redis database.

'redis://:secret@127.0.0.1:6379/12'
onUnexpectedFailure

A function to call any time an unexpected error event is received from this manager or any of its connections.

'->'
meta

Additional Redis-specific options to use when connecting.

'==='

Exits

error

An unexpected error occurred.

malformed

The provided connection string is not valid for MySQL.

{ error: '===', meta: '===' }
failed

Could not create a connection manager for this database using the specified connection string.

{ error: '===', meta: '===' }
success

OK.

{ manager: '===', meta: '===' }