daurnimator / lredis Goto Github PK
View Code? Open in Web Editor NEWA redis client for lua
License: MIT License
A redis client for lua
License: MIT License
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()
@daurnimator I discovered a deadlock issue which is caused by an error that occurs during a pipelined request. I've fixed the issue in this PR #7
This PR causes the Travis CI build to fail on Lua 5.1 only, but I have no idea why it should do so.
libssl-dev
installed in order to build cqueues
.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
Add support for XADD / XREAD / XRANGE / XREVRANGE / XLEN ... operations
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
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.