nrk / redis-lua

A Lua client library for the redis key value storage system.
MIT License
731 stars 239 forks source link

Allow alternative coroutine implementations #41

Open saucisson opened 9 years ago

saucisson commented 9 years ago

This is required when using redis-lua within scheduled coroutines, for instance with copas. When using the standard coroutine implementation, yields from the network operations (receive, send) can be caught by the iterators of redis-lua, instead of the scheduler.

This patch works together with the construction of a client from a socket: copas wrapped sockets can be given to redis-lua.

Below are links to:

nrk commented 9 years ago

Thanks @saucisson, I'm very interested in your PR but unfortunately I won't be able to review or even try your changes at least until the 2nd week of December as I'm leaving tomorrow and will be overseas until then. In the meanwhile feel free to push new changes if needed.

Thanks!

saucisson commented 9 years ago

The alternative coroutine implementation (https://github.com/saucisson/lua-coronest) has just been released as a rock (https://rocks.moonscript.org/modules/saucisson/coronest), and documented a bit more, and can now be installed easily if needed.

pounard commented 8 years ago

@saucisson I'd be curious to know why are you doing this ? I do have a specific need: use a nginx specific API to attempt to maintain the connection to redis persistent, because doing a reconnect on each HTTP query in order to do my access checks is way too slow.