The script editor provides a simple Lua development environment.
Redis has built-in support for executing Lua scripts. Two reasons you might use Lua scripts with Redis are for the atomicity (due to the single-threaded nature of Redis) and reduction of round-trip communication by keeping all of the logic executed on the server.
To use Lua scripts with Redis, you must provide:
For more information, refer to the official Redis documentation.
Use the key editor to add any keys required as input to your Lua script.
Reddie will show you the corresponding KEYS
array index, any detected hash tags and verify that all keys hash to the same slot.
Add a key
Redis Cluster uses the concept of hash slots to divide up data storage responsibility between each peer. (see What are Slots?).
As a result, to ensure that all of the keys used by a Lua script execution are co-located on the same server running the script, Redis requires all specified keys to hash to the same slot. To manage this, Redis Cluster supports “hash tags”.
Hash tags are sub sections of a key that are surrounded by curly braces ({}
) that cause Redis to only hash that portion of the key when determining the hash slot.
This allows you to guarantee that all keys are present in the same hash slot by using a key naming scheme with hash tags.
Refer to the Redis Cluster specification for more information.
Use the argument editor to add arguments to the Lua script function.
Reddie will show you the corresponding ARGV
array index.
Add an argument
Develop the Lua script needed with the built-in editor. Click the Run button to execute the script with the specified keys and arguments.
Run the script
If the script generates any output, it will be displayed below the script editor.
Whenever a script is executed it is stored inside the browser’s local storage. This allows you to easily refer back to scripts you have written in the past. Click anywhere in the command history item to load its script, keys and arguments into the editor.
Remove script history