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