Code Monkey home page Code Monkey logo

hiredis-node's Introduction

Build Status

hiredis-node

Node extension that wraps hiredis. Because Node is already good at doing I/O, hiredis-node only provides bindings to the protocol parser. The hiredis protocol parser is faster than JavaScript protocol parsers, but the speedup only becomes noticeable for large replies. If you use Redis for simple SET/GET operations, there won't be a big benefit to using hiredis. If you use Redis for big SUNION/SINTER/LRANGE/ZRANGE operations, the benefit to using hiredis-node can be significant.

Install

Install with NPM:

npm install hiredis

This requires:

  • gcc / g++ 4.8 or newer.
  • python 2.7 or any newer 2.x version. python 3.x is not supported.

For running on Travis check the bundled .travis.yml.

Contribute

To work on the code, first fetch the bundled hiredis submodule, then build hiredis and run the tests.

git submodule update --init
npm install
npm test

Usage

hiredis-node works out of the box with Matt Ranney's node_redis. The latter has an optional dependency on hiredis-node, so maybe you're already using it without knowing.

Alternatively, you can use it directly:

var hiredis = require("hiredis"),
    reader = new hiredis.Reader();

// Data comes in
reader.feed("$5\r\nhello\r\n");

// Reply comes out
reader.get() // => "hello"

Instead of returning strings for bulk payloads, it can also return buffers:

var hiredis = require("hiredis"),
    reader = new hiredis.Reader({ return_buffers: true });

// Data comes in
reader.feed("$5\r\nhello\r\n");

// Reply comes out
reader.get() // => <Buffer 68 65 6c 6c 6f>

Windows

Since Version 0.3.0 hiredis-node officially supports Windows. A simple npm install hiredis should just work. If not, please open a bug report.

There's also a Windows fork by Dmitry Gorbunos (@fuwaneko), which should now be unnecessary.

License

This code is released under the BSD license, after the license of hiredis.

hiredis-node's People

Contributors

pietern avatar badboy avatar tootallnate avatar greenkeeperio-bot avatar kkoopa avatar dainis avatar nschonni avatar ricordisamoa avatar heavyk avatar wilkinson avatar bridgear avatar zubairov avatar randomfactor avatar pdehaan avatar nicolashenry avatar mjackson avatar jonathanong avatar iamstolis avatar aeosynth avatar djanowski avatar chrisportela avatar aeisenberg avatar vodolaz095 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.