Execute
运行 Redis 命令。这是 executeArray 的更灵活版本。
public static java.lang.Object execute(java.lang.String... command)
运行 Redis 命令,类似于 executeArray
。然而,execute
函数更灵活。与 executeArray
不同,字符串参数列表不必是显式的 String[]
对象。它允许以下函数调用execute("SET", "key", "value")
.
参数
名称 | 类型 | 描述 |
---|---|---|
command | string | 一个 Redis 命令 |
返回值
返回命令结果。它可能是字符串或字符串数组,取决于命令。
示例
不使用 String[]
GearsBuilder.execute("SET", "age:maximum", "100");
使用 String[]
GearsBuilder.execute(new String[]{"SET", "age:maximum", "100"});