I want to use lua script to make atomic Redis operation using php/reids extension, so my code is:
$command = " local hashes = redis.call('smembers', ARGV) for hash in pairs(hashes) do local keys = redis.call('hkeys', hash) for key in pairs(keys) do redis.call('hset', key, 0) end end return 1 "; $result = $this->redisClient->evaluate($command, [self::ALL_HASHES]);
this script should take all availavle hashes from
self::ALL_HASHES set, loop through each hash, and set value for each hash key to 0. Script is passing, and
$error = $this->redisClient->getLastError(); is
null, but values are not 0. What I'm doing wrong? I'm new to Lua, it's my first script.