0.0.17 • Published 12 years ago

redjs v0.0.17

Weekly downloads
76
License
-
Repository
github
Last release
12 years ago

redjs

Lighweight redis library for node.js

Stability: 1 - Experimental

api

createDriver(opt_options)

Create a new driver object. Driver extends Client.

On load the all commands from lib/commands.js are populated on the drivers prototype.

var driver = redjs.createDriver();
driver.connect(function() {
  driver.set('testkey', 'a', function(err, reply) {
    console.log(reply);
  });
});

createClient(opt_options)

Create a new client object. Client extends EventEmitter.

opt_options contains optional configuration:

{
  host: '127.0.0.1',
  port: 6379
}

client.connect(opt_callback)

opt_callback is registered as listener for the 'connect' event.

client.send(var_args, opt_callback)

var client = redjs.createClient();
client.connect(function() {
  client.send('SET', 'keyA', '1');
  client.send('KEYS', '*', function(err, reply) {
    console.log(reply);
  });
});

Or use an Array as 1st argument

client.send(['REM', 'keyA', 'keyB', 'keyC'], function(err, replies) {
  console.log(replies);
});

Event: 'connect'

Event: 'error'

function(err)

createParser()

Create a new parser object. Parser is a Stream.

parser.write(buffer)

Event: 'reply'

funtion(type, value)

type is one of status, error, number, bulk, multi.

value depends on type.

Event: 'error'

funtion(err)

tests

make jshint
make test
0.0.17

12 years ago

0.0.16

12 years ago

0.0.15

12 years ago

0.0.14

12 years ago

0.0.13

12 years ago

0.0.12

12 years ago

0.0.11

12 years ago

0.0.10

12 years ago

0.0.9

12 years ago

0.0.8

12 years ago

0.0.7

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.2-dev

12 years ago

0.0.1

12 years ago