List of usage examples for org.springframework.data.redis.connection.jedis JedisClientUtils execute
static <T> T execute(String command, byte[][] keys, byte[][] args, Supplier<Jedis> jedis)
From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java
@Nullable @Override//www . ja va 2 s. co m public Object execute(String command, byte[]... args) { Assert.notNull(command, "Command must not be null!"); Assert.notNull(args, "Args must not be null!"); return clusterCommandExecutor .executeCommandOnArbitraryNode((JedisClusterCommandCallback<Object>) client -> JedisClientUtils .execute(command, EMPTY_2D_BYTE_ARRAY, args, () -> client)) .getValue(); }
From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java
/** * Execute the given command for each key in {@code keys} provided appending all {@code args} on each invocation. * <br />//from w w w. j a v a 2s . c o m * This method, other than {@link #execute(String, byte[]...)}, dispatches the command to the {@code key} serving * master node and appends the {@code key} as first command argument to the {@code command}. {@code keys} are not * required to share the same slot for single-key commands. Multi-key commands carrying their keys in {@code args} * still require to share the same slot as the {@code key}. * * <pre> * <code> * // SET foo bar EX 10 NX * execute("SET", "foo".getBytes(), asBinaryList("bar", "EX", 10, "NX")) * </code> * </pre> * * @param command must not be {@literal null}. * @param keys must not be {@literal null}. * @param args must not be {@literal null}. * @return command result as delivered by the underlying Redis driver. Can be {@literal null}. * @since 2.1 */ @Nullable public <T> List<T> execute(String command, Collection<byte[]> keys, Collection<byte[]> args) { Assert.notNull(command, "Command must not be null!"); Assert.notNull(keys, "Key must not be null!"); Assert.notNull(args, "Args must not be null!"); return clusterCommandExecutor .executeMultiKeyCommand((JedisMultiKeyClusterCommandCallback<T>) (client, key) -> { return JedisClientUtils.execute(command, new byte[][] { key }, args.toArray(new byte[args.size()][]), () -> client); }, keys).resultsAsList(); }