Giter Site home page Giter Site logo

nedis's Introduction

Nedis

Nedis is a (partial) redis implementation written with node. Primarily for fun.

Installation

 $ npm install nedis

Trying It Out

Since nedis implements the unified redis prototcol, we can use redis-cli with nedis! First start the server:

 $ nedis-server

Now play with the cli:

 $ redis-cli 

 redis> hmset users:tj email [email protected] age 23
 OK
 redis> hgetall users:tj
 1) "email"
 2) "[email protected]"
 3) "age"
 4) "23"
 redis> keys users:*
 1) "users:tj"
 redis> 

Booting Nedis

nedis.createServer().listen([port[, host]]);

Running Tests

$ make test

Performance

Really non-scientific results of GET / SET:

SET
nedis: ops 25048, per second 5009.6
redis: ops 54850, per second 10970

GET
nedis: ops 32729, per second 6545.8
redis: ops 54714, per second 10942.8

License

(The MIT License)

Copyright (c) 2011 TJ Holowaychuk <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

nedis's People

Contributors

aheckmann avatar grumdrig avatar janpieper avatar tj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nedis's Issues

node 0.6.x support

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: [email protected]
npm ERR! Required: {"node":"0.4.x"}
npm ERR! Actual:   {"npm":"1.1.0-2","node":"0.6.8"}

"multi" support

Just realized my favorite redis client needs multi support. Any tips on how to implement it myself?

Grow buffer

data buffer is currently limited to 64k, just gotta grow appropriately

pubsub

Hi!

Plans on the subj?

--Vladimir

"Socket is not writable" when sending QUIT

I discovered a problem, where in out testsuite I'm sending a QUIT (in a test-teardown function) to close the client's connection. If there are outstanding responses from other requests to nedis, you'll see:

    Error: Socket is not writable
        at Socket._writeOut (net.js:391:11)
        at Socket.write (net.js:377:17)
        at Connection.bool (./node_modules/nedis/lib/connection.js:152:15)
        at Object.expire (./node_modules/nedis/lib/commands/keys.js:27:12)
        at Connection.invoke (./node_modules/nedis/lib/connection.js:193:13)
        at Connection.parse (./node_modules/nedis/lib/connection.js:395:18)
        at Socket.<anonymous> (native)
        at Socket.emit (events.js:64:17)
        at Socket._onReadable (net.js:672:14)
        at IOWatcher.onReadable [as callback] (net.js:177:10)

The problem is, that in connection.js (e.g. https://github.com/visionmedia/nedis/blob/master/lib/connection.js#L152) it is not checked, if the stream is writable or not.

I'd like to supply a patch for this problem, but I'd also like to know how you would like it to be solved. Is it correct to just call a wrapper function that will first check if (this.stream.writable) before actually doing this.stream.write(...)? Are there any bad tradeoffs I'm not seeing yet?

Best

Sebastian

Node fails under load

doing 100,000 SETs even with a 1ms timeout produces random results.. the parser could be slightly off, however even when DBSIZE reports back with a large number the AOF contains farrrr less, which is not good :) node's fs.WriteStream seems to be failing

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.