Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.

Redis v2.6 Lua Scripting #11

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Conversation

sjhewitt
Copy link
Contributor

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: redis/redis-py#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?)

@legastero
Copy link
Contributor

Yes there will be separate repo for the Lua scripts. Look in github.com/andyet/thoonk.js in the scripting branch for what has been converted so far.

Interestingly, this topic was just raised in the thoonk.js version a few days ago: andyet/thoonk.js#12

@sjhewitt
Copy link
Contributor Author

Yeah, I saw the scripting branch on thoonk.js, but i'm more interested in the python version at the moment, so put my contributions here (plus there's only the one lua script there, which I copied to the scripts folder here)

I'm holding off converting the other scripts if there's going to be a change to the contracts to handle versioning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants