andyet/thoonk.py — pull request #11 by sjhewitt (2011-11-19 14:57:19+00:00)
Title: Redis v2.6 Lua Scripting

I've started converting the python library to use the new Lua scripting (starting with the Job feeds)

This uses the redis-py lua scripting branch discussed here: https://github.com/andymccurdy/redis-py/pull/207

As it's possible to do logic within the lua scripts, I've replaced this construct from the contracts:

```
WATCH [schema]:[feed]
ZRANK [schema]:[feed] [id] // if nil: fail
MULTI
ZREM [schema]:[feed] [id]
EXEC
```

with this (the ```ZRANK``` call is no longer necessary)

```
if redis.call('zrem', [schema]:[feed]) == 0 then
return false
end
```

On a side note, is there a plan for maintaining common versions of the lua scripts for all language implementations? (maybe in a separate repo?)