@Override public byte[] get(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().get(key))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().get(key))); return null; } return connection.getJedis().get(key); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public List<byte[]> sPop(byte[] key, long count) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().spop(key, count), ArrayList::new)); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().spop(key, count), ArrayList::new)); return null; } return new ArrayList<>(connection.getJedis().spop(key, count)); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean hExists(byte[] key, byte[] field) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Fields must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hexists(key, field))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hexists(key, field))); return null; } return connection.getJedis().hexists(key, field); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long zRank(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().zrank(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().zrank(key, value))); return null; } return connection.getJedis().zrank(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double zScore(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().zscore(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().zscore(key, value))); return null; } return connection.getJedis().zscore(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long rPushX(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().rpushx(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().rpushx(key, value))); return null; } return connection.getJedis().rpushx(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] hGet(byte[] key, byte[] field) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hget(key, field))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hget(key, field))); return null; } return connection.getJedis().hget(key, field); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long hIncrBy(byte[] key, byte[] field, long delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hincrBy(key, field, delta))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hincrBy(key, field, delta))); return null; } return connection.getJedis().hincrBy(key, field, delta); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double hIncrBy(byte[] key, byte[] field, double delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hincrByFloat(key, field, delta))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hincrByFloat(key, field, delta))); return null; } return connection.getJedis().hincrByFloat(key, field, delta); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) { Assert.notNull(srcKey, "Source key must not be null!"); Assert.notNull(dstKey, "Destination key must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().brpoplpush(srcKey, dstKey, timeout))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().brpoplpush(srcKey, dstKey, timeout))); return null; } return connection.getJedis().brpoplpush(srcKey, dstKey, timeout); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Nullable @Override public Long refcount(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().objectRefcount(key))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().objectRefcount(key))); return null; } return connection.getJedis().objectRefcount(key); } catch (Exception ex) { throw connection.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 { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().getSet(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().getSet(key, value))); return null; } return connection.getJedis().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 { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().append(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().append(key, value))); return null; } return connection.getJedis().append(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Boolean sIsMember(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().sismember(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().sismember(key, value))); return null; } return connection.getJedis().sismember(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) { Assert.notNull(srcKey, "Source key must not be null!"); Assert.notNull(dstKey, "Destination key must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().rpoplpush(srcKey, dstKey))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().rpoplpush(srcKey, dstKey))); return null; } return connection.getJedis().rpoplpush(srcKey, dstKey); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Double zIncrBy(byte[] key, double increment, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().zincrby(key, increment, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().zincrby(key, increment, value))); return null; } return connection.getJedis().zincrby(key, increment, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long lPushX(byte[] key, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().lpushx(key, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().lpushx(key, value))); return null; } return connection.getJedis().lpushx(key, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long lRem(byte[] key, long count, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().lrem(key, count, value))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().lrem(key, count, value))); return null; } return connection.getJedis().lrem(key, count, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long hDel(byte[] key, byte[]... fields) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(fields, "Fields must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hdel(key, fields))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hdel(key, fields))); return null; } return connection.getJedis().hdel(key, fields); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public List<byte[]> hMGet(byte[] key, byte[]... fields) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(fields, "Fields must not be null!"); try { if (isPipelined()) { pipeline(connection.newJedisResult(connection.getRequiredPipeline().hmget(key, fields))); return null; } if (isQueueing()) { transaction(connection.newJedisResult(connection.getRequiredTransaction().hmget(key, fields))); return null; } return connection.getJedis().hmget(key, fields); } catch (Exception ex) { throw convertJedisAccessException(ex); } }