@Override public List<Long> bitField(byte[] key, BitFieldSubCommands subCommands) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(subCommands, "Command must not be null!"); byte[][] args = JedisConverters.toBitfieldCommandArguments(subCommands); try { return connection.execute("BITFIELD", key, Arrays.asList(args), Connection::getIntegerMultiBulkReply); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] getSet(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { return connection.getCluster().getSet(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long append(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { return connection.getCluster().append(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public void setRange(byte[] key, byte[] value, long offset) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { connection.getCluster().setrange(key, offset, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long incr(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().incr(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long bitCount(byte[] key, long start, long end) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().bitcount(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long strLen(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().strlen(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long decrBy(byte[] key, long value) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().decrBy(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] getRange(byte[] key, long start, long end) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().getrange(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean getBit(byte[] key, long offset) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().getbit(key, offset); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long bitCount(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().bitcount(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean setEx(byte[] key, long seconds, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); if (seconds > Integer.MAX_VALUE) { throw new IllegalArgumentException("Seconds have cannot exceed Integer.MAX_VALUE!"); } try { return Converters.stringToBoolean(connection.getCluster().setex(key, Long.valueOf(seconds).intValue(), value)); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] get(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().get(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long incrBy(byte[] key, long value) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().incrBy(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double incrBy(byte[] key, double value) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().incrByFloat(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long decr(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().decr(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean setBit(byte[] key, long offset, boolean value) { Assert.notNull(key, "Key must not be null!"); try { return connection.getCluster().setbit(key, offset, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean set(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { return Converters.stringToBoolean(connection.getCluster().set(key, value)); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean setNX(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { return JedisConverters.toBoolean(connection.getCluster().setnx(key, value)); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long bitOp(BitOperation op, byte[] destination, byte[]... keys) { Assert.notNull(op, "BitOperation must not be null!"); Assert.notNull(destination, "Destination key must not be null!"); byte[][] allKeys = ByteUtils.mergeArrays(destination, keys); if (ClusterSlotHashUtil.isSameSlotForAllKeys(allKeys)) { try { return connection.getCluster().bitop(JedisConverters.toBitOp(op), destination, keys); } catch (Exception ex) { throw convertJedisAccessException(ex); } } throw new InvalidDataAccessApiUsageException("BITOP is only supported for same slot keys in cluster mode."); }