public static ZIncrByParams zIncrByParams() { return new ZIncrByParams(); }
/** * Only set the key if it does not already exist. * @return ZIncrByParams */ public ZIncrByParams nx() { addParam(NX); return this; }
public byte[][] getByteParams(byte[] key, byte[]... args) { ArrayList<byte[]> byteParams = new ArrayList<byte[]>(); byteParams.add(key); if (contains(NX)) { byteParams.add(SafeEncoder.encode(NX)); } if (contains(XX)) { byteParams.add(SafeEncoder.encode(XX)); } byteParams.add(SafeEncoder.encode(INCR)); for (byte[] arg : args) { byteParams.add(arg); } return byteParams.toArray(new byte[byteParams.size()][]); }
public void zincrby(final byte[] key, final double score, final byte[] member, final ZIncrByParams params) { // Note that it actually calls ZADD with INCR option, so it requires Redis 3.0.2 or upper. sendCommand(ZADD, params.getByteParams(key, toByteArray(score), member)); }
@Test public void testZincrby() { jedisCluster.zincrby("key", 1337, "member"); jedisCluster.zincrby("key", 1337, "member", ZIncrByParams.zIncrByParams()); }
/** * Only set the key if it already exist. * @return ZIncrByParams */ public ZIncrByParams xx() { addParam(XX); return this; }