Redis 简明教程
Redis - Scripting
Redis 脚本用于使用 Lua 解释器评估脚本。它内置于 Redis 2.6.0 以上的版本中。用于脚本的命令是 EVAL 命令。
Redis scripting is used to evaluate scripts using the Lua interpreter. It is built into Redis starting from version 2.6.0. The command used for scripting is EVAL command.
Syntax
以下是 EVAL 命令的基本语法。
Following is the basic syntax of EVAL command.
redis 127.0.0.1:6379> EVAL script numkeys key [key ...] arg [arg ...]
Redis Scripting Commands
以下表格列出了一些与 Redis 脚本相关的基本命令。
Following table lists some basic commands related to Redis Scripting.
Sr.No |
Command & Description |
1 |
EVAL script numkeys key [key …] arg [arg …]Executes a Lua script. |
2 |
EVALSHA sha1 numkeys key [key …] arg [arg …]Executes a Lua script. |
3 |
SCRIPT EXISTS script [script …]Checks the existence of scripts in the script cache. |
4 |
SCRIPT FLUSHRemoves all the scripts from the script cache. |
5 |
SCRIPT KILLKills the script currently in execution. |
6 |
SCRIPT LOAD scriptLoads the specified Lua script into the script cache. |