ApsaraDB for Redis instances of all editions support Lua commands.
Support for Lua commands
The use of Lua scripts improves the performance of Redis. With the built-in Lua support, Redis is able to perform an efficient check-and-set (CAS) operation on commands. It also allows you to combine and run multiple commands in an efficient manner.
ERR command eval not support for normal useris returned, you can upgrade the minor version and try again. For more information, see Upgrade the minor version. During the upgrade, the instance may be disconnected and become read-only within seconds. We recommend that you upgrade the version of an instance during off-peak hours.
Limits on Lua scripts
To ensure that all operations in a Lua script are performed in the same hash slot, the cluster edition of ApsaraDB for Redis sets the following limits on a Lua script:
- The Lua script uses the redis.call/redis.pcall function to call Redis commands. For these commands, all the keys must be passed
by using the KEYS array, which cannot be replaced by Lua variables. Otherwise, the
following error message is returned:
-ERR bad lua script for redis cluster, all the keys that the script uses should be passed using the KEYS arrayrn
- All the keys that the script uses must be allocated in the same hash slot. Otherwise,
the following error message is returned:
-ERR eval/evalsha command keys must be in same slotrn
- Keys must be passed for all the commands to be called. Otherwise, the following error
message is returned:
-ERR for redis cluster, eval/evalsha number of keys can't be negative or zerorn