fakeredis icon indicating copy to clipboard operation
fakeredis copied to clipboard

Support LUA scripting

Open ThiefMaster opened this issue 11 years ago • 7 comments

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.

ThiefMaster avatar Apr 17 '13 09:04 ThiefMaster

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.

jamesls avatar Apr 18 '13 03:04 jamesls

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

bmerry avatar Mar 22 '18 14:03 bmerry

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

pip install fakeredis[lua]

Documentation should be updated..

advance512 avatar Jan 16 '19 19:01 advance512

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.

bmerry avatar Jan 17 '19 08:01 bmerry

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

advance512 avatar Jan 17 '19 11:01 advance512

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.

SebastiaanZ avatar Oct 04 '20 17:10 SebastiaanZ

cjson is not supported :(

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

rodriguez-facundo avatar Dec 29 '21 16:12 rodriguez-facundo