private byte[][] getArgsAddTimeout(int timeout, byte[][] keys) { int size = keys.length; final byte[][] args = new byte[size + 1][]; for (int at = 0; at != size; ++at) { args[at] = keys[at]; } args[size] = Protocol.toByteArray(timeout); return args; }
public void migrate(final byte[] host, final int port, final byte[] key, final int destinationDb, final int timeout) { sendCommand(MIGRATE, host, toByteArray(port), key, toByteArray(destinationDb), toByteArray(timeout)); }
public void zrangeByScore(final byte[] key, final double min, final double max, final int offset, int count) { byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min); byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max); sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax, LIMIT.raw, toByteArray(offset), toByteArray(count)); }
public void zrangeByScoreWithScores(final byte[] key, final double min, final double max, final int offset, final int count) { byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min); byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max); sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax, LIMIT.raw, toByteArray(offset), toByteArray(count), WITHSCORES.raw); }
public void zrevrangeByScoreWithScores(final byte[] key, final double max, final double min, final int offset, final int count) { byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min); byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max); sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin, LIMIT.raw, toByteArray(offset), toByteArray(count), WITHSCORES.raw); }
@Override public Set<byte[]> zrevrangeByScore(final byte[] key, final double max, final double min, final int offset, final int count) { return zrevrangeByScore(key, toByteArray(max), toByteArray(min), offset, count); }
public void zrangeByScoreWithScores(final byte[] key, final byte[] min, final byte[] max, final int offset, final int count) { sendCommand(ZRANGEBYSCORE, key, min, max, LIMIT.raw, toByteArray(offset), toByteArray(count), WITHSCORES.raw); }
public void zrevrangeByScoreWithScores(final byte[] key, final double max, final double min) { byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min); byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max); sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin, WITHSCORES.raw); }
public void zcount(final byte[] key, final double min, final double max) { byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min); byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max); sendCommand(ZCOUNT, key, byteArrayMin, byteArrayMax); }
public void brpop(final int timeout, final byte[]... keys) { final List<byte[]> args = new ArrayList<byte[]>(); for (final byte[] arg : keys) { args.add(arg); } args.add(Protocol.toByteArray(timeout)); brpop(args.toArray(new byte[args.size()][])); }
@Override public void zrangeByScore(final String key, final double min, final double max, final int offset, int count) { zrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset, count); }
@Override public void zrangeByScoreWithScores(final String key, final double min, final double max, final int offset, final int count) { zrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset, count); }
@Override public void zrevrangeByScore(final String key, final double max, final double min, final int offset, int count) { zrevrangeByScore(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset, count); }
@Override public void zrevrangeByScoreWithScores(final String key, final double max, final double min, final int offset, final int count) { zrevrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset, count); }
private List<byte[]> convertGeoCoordinateMapToByteArrays( Map<byte[], GeoCoordinate> memberCoordinateMap) { List<byte[]> args = new ArrayList<byte[]>(memberCoordinateMap.size() * 3); for (Entry<byte[], GeoCoordinate> entry : memberCoordinateMap.entrySet()) { GeoCoordinate coordinate = entry.getValue(); args.add(toByteArray(coordinate.getLongitude())); args.add(toByteArray(coordinate.getLatitude())); args.add(entry.getKey()); } return args; } }
public void zunionstore(final byte[] dstkey, final ZParams params, final byte[]... sets) { final List<byte[]> args = new ArrayList<byte[]>(); args.add(dstkey); args.add(Protocol.toByteArray(sets.length)); for (final byte[] set : sets) { args.add(set); } args.addAll(params.getParams()); sendCommand(ZUNIONSTORE, args.toArray(new byte[args.size()][])); }
@Override public Response<Long> zcount(byte[] key, double min, double max) { getClient(key).zcount(key, toByteArray(min), toByteArray(max)); return getResponse(BuilderFactory.LONG); }
@Override public Response<Set<byte[]>> zrevrangeByScore(byte[] key, double max, double min, int offset, int count) { getClient(key).zrevrangeByScore(key, toByteArray(max), toByteArray(min), offset, count); return getResponse(BuilderFactory.BYTE_ARRAY_ZSET); }
@Override public Response<Set<Tuple>> zrevrangeByScoreWithScores(byte[] key, double max, double min) { getClient(key).zrevrangeByScoreWithScores(key, toByteArray(max), toByteArray(min)); return getResponse(BuilderFactory.TUPLE_ZSET_BINARY); }
public void cluster(final String subcommand, final int... args) { final byte[][] arg = new byte[args.length + 1][]; for (int i = 1; i < arg.length; i++) { arg[i] = toByteArray(args[i - 1]); } arg[0] = SafeEncoder.encode(subcommand); cluster(arg); }