Redis operation in php uses lua, but it cannot be executed consistently. Please help everyone take a look.
習慣沉默
習慣沉默 2017-05-16 13:05:41
0
2
695

1.When using redis.eval to operate the Lua script in php, an error occurred. I don’t know what the problem is. Please help me. Thank you

The set value is entered, use eval to call lua to detect if the value of my:lock is this value, delete it, but this step is wrong, can you help me take a look, thank you

習慣沉默
習慣沉默

reply all(2)
我想大声告诉你

I don’t know much about PHP, but I am familiar with redis. I guess there is something wrong here.
eval($script, $a, 1)eval($script, $a, 1)
因为redis默认eval命令的参数依次是:lua脚本,键值对个数,所有的键名,所有的值。
我不知道php里的redis库有没有修改这个顺序,如果不对请忽略这个答案吧,否则你可以试试下面这样。
eval($script, 1, $a)
另外,这里$a是个数组,其实应该拆开来传值吧?
eval(#script, 1, $a[0], $a[1])Because the parameters of redis’ default eval command are: lua script, the number of key-value pairs, all key names, and all values.

I don’t know if the redis library in php has modified this order. If it is wrong, please ignore this answer, otherwise you can try the following. 🎜eval($script, 1, $a)🎜In addition, $a here is an array. In fact, it should be split to pass the value, right? 🎜eval(#script, 1, $a[0], $a[1])🎜
淡淡烟草味

What I’m curious about is why do I need to adjust Lua in PHP to implement this logic? If you use PHP to read the value of this key from redis and compare it, can you realize the logic you want?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template