Redis Client for fend (https://github.com/chatid/fend)
All functions will throw a lua error if they encounter a problem.
Modules can be required individually, or all will be available under redis = require "fend-redis"
###fend-redis
-
red = redis.add_sock ( dispatch , sock )
Adds a listener to the givendispatch
for the connected redis socketsock
-
red:query ( callback , ... )
Send a command to redis.
Vararg is sent tofend-redis.construct
When it is done:callback ( redisReply , err )
is called with the reply orcallback ( nil , error_string )
in case of failure. -
red:cmd ( ... )
Send a command to redis; throw a lua error on failure.
###fend-redis.reply
Adds a metatype to redisReply
value , str = myreply:toLua()
Converts the reply to lua objectvalue
. For success or error replys, returns a descriptive string.
###fend-redis.reader
A thin wrapper around the hiredis redisReader
structure
-
myreader = reader.Create()
Returns aredisReader
object -
myreader:Feed ( string )
myreader:Feed ( buff , length )
Copies data to the internalmyreader
buffer -
myreader:GetReply ( )
Parses data in the internal buffer, returning the next availableredisReply
Returnsnil
if no more complete replies found -
myreader:GetReplies ( )
Suitable for use as an iterator:
print ( reply )
end```
###fend-redis.construct
This module returns a function that can construct a redis request.
eg, `construct ( "KEYS" , "*" )`
###fend-redis.fifo
Is the fifo library original from [lomp](https://github.com/daurnimator/lomp2/blob/master/fifo.lua)