Redis 脚本命令

更新时间: 2019-07-07 15:54

Redis 脚本使用 Lua 解释器来执行脚本。 Redis 2.6 版本通过内嵌支持 Lua 环境。执行脚本的常用命令为 EVAL。

语法

Eval 命令的基本语法如下:

redis 127.0.0.1:6379> EVAL script numkeys key [key ...] arg [arg ...]

实例

以下实例演示了 redis 脚本工作过程:

redis 127.0.0.1:6379> EVAL "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 first second

1) "key1"
2) "key2"
3) "first"
4) "second"

Redis 脚本命令

下表列出了 redis 脚本常用命令:

序号 命令 描述
1 Redis Eval 命令 执行 Lua 脚本。
2 Redis Evalsha 命令 执行 Lua 脚本。
3 Redis Script Exists 命令 查看指定的脚本是否已经被保存在缓存当中。
4 Redis Script Flush 命令 从脚本缓存中移除所有脚本。
5 Redis Script kill 命令 杀死当前正在运行的 Lua 脚本。
6 Redis Script Load 命令 将脚本 script 添加到脚本缓存中,但并不立即执行这个脚本。

更多命令请参考:Redis 命令

Algorithm Design

Algorithm Design

Jon Kleinberg、Éva Tardos / Addison-Wesley / 2005-3-26 / USD 144.20

Algorithm Design introduces algorithms by looking at the real-world problems that motivate them. The book teaches students a range of design and analysis techniques for problems that arise in compu......一起来看看 《Algorithm Design》 这本书的介绍吧!

HTML 压缩/解压工具

HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器

在线进制转换器

各进制数互转换器

图片转BASE64编码

图片转BASE64编码

在线图片转Base64编码工具