jamesls / fakeredis

Fake implementation of redis API (redis-py) for testing purposes
703 stars 183 forks source link

Support LUA scripting #25

Open ThiefMaster opened 11 years ago

ThiefMaster commented 11 years ago

It would be nice if fakeredis supported LUA scripts like redis does. LUA bindings for python are available so it might not be that hard - never used them though.

Why would it be useful? Well, chances are good that the usage of lua scripts means there is some more complex logic involved that cannot be easily done with simply redis commands. Chances are good that this logic should be well-tested and thus having lua support in fakeredis would be helpful.

jamesls commented 11 years ago

I agree that it would be great to have Lua support. I've been thinking about how to best accomplish this. Unfortunately, I had trouble installing the official lunatic-python package and it seem like it doesn't support lua 5.1, but I'm looking into other alternative approaches. I've had success with some of the other lunatic-python forks though so maybe that's the best approach.

bmerry commented 6 years ago

fakeredis 0.10.1 has some scripting support (eval command), but I'm leaving this open because it's still incomplete.

advance512 commented 5 years ago

FYI all, to get Lua support, you need to install it like:

pip install fakeredis[lua]

Documentation should be updated..

bmerry commented 5 years ago

Good point. I've updated the README on the 1.0 branch. It'll appear in the README when I release 1.0, which should be quite soon.

advance512 commented 5 years ago

Great, waiting for it. This has been a good drop-in replacement for mockredis which is abandoned, or so it seems.

https://github.com/locationlabs/mockredis/issues/130

SebastiaanZ commented 4 years ago

I've opened a PR for SCRIPT EXISTS and SCRIPT FLUSH. Not sure if the implementation is up to standards, but it's here: #281.

rodriguez-facundo commented 2 years ago

cjson is not supported :(

Error running script (call to f_7cfc597423ec5ba5cf79190e397fb9dbeaf35226): @user_script:?: [string "<python>"]:139: attempt to index a nil value (global 'cjson')