Code Monkey home page Code Monkey logo

lredis's People

Contributors

daurnimator 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

Watchers

 avatar  avatar  avatar  avatar  avatar

lredis's Issues

MULTI transactions are not protected against pipelined command injection

cq:wrap(function()
  client:multi()
  cqueues.sleep(5)
  client:call('get', 'test')
  client:exec()
end)

cq:wrap(function()
  cqueues.sleep(2)
  client:ping()
end)

cq:loop()

In this example, the pipelined PING command is erroneously inserted into the MULTI. I have fixed this in PR #9 which implements locking around transactions. This requires a small change to the API:

cq:wrap(function()
  local t = client:multi()
  cqueues.sleep(5)
  t:call('get', 'test')
  t:exec()
end)

cq:wrap(function()
  cqueues.sleep(2)
  client:ping() -- this is now blocked until the exec() completes.
end)

cq:loop()

Trouble installing luarock dependencies

  1. You might want to note that you need libssl-dev installed in order to build cqueues.
  2. After clearing that hurdle, I run into this:
Using http://luarocks.org/dev/fifo-scm-0.src.rock... switching to 'build' mode
Warning: /usr/local/share/lua/5.1/fifo.lua is not tracked by this installation of LuaRocks. Moving it to /usr/local/share/lua/5.1/fifo.lua~
Updating manifest for /usr/local/lib/luarocks/rocks
fifo scm-0 is now built and installed in /usr/local (license: MIT/X11)


Error: Unknown protocol git+https

Reuse protocol implementation from lluv-redis.

This is just suggestion.
lluv-redis implement protocol in independent from libuv and in fact it pure lua.
Basic usage

--- Stream class do protocol decode/encode

-- all handlers gets SELF as first argument
stream = RedisStream.new(SELF)
-- do write here
:on_command(function(self, data)
  -- write `data` to output stream
  -- call 
end)
-- handle async messages here
:on_message(function(self, channel, data)
end)
-- internal or protocol error
:on_halt(function(self, err)
end)

-- read data from input stream
chunk = io.read

-- append data to stream and execute 
stream:append(chunk):execute()

-- any command 
stream:command(<COMMAND HERE>, function(self, err, result)
...
end)

--- Commander class encode/decode arguments/reuslts of command

command = RedisCommander.new(stream)
command:ping(function(self, err, ok) end)

This is basic example of implement sync client based on LuaSocket

Auto-reconnect

Hi there, thanks for lredis!

Is there currently any preferred pattern to add auto-reconnect capabilities to lredis?

This is a feature which all redis lua libraries seem to be lacking, unfortunately:
nrk/redis-lua#9

Thanks!

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.