@Override public Boolean hSet(byte[] key, byte[] field, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hset(key, field, value))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hset(key, field, value))); return null; } return getConnection().hset(key, field, value); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Boolean hSetNX(byte[] key, byte[] field, byte[] value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(field, "Field must not be null!"); Assert.notNull(value, "Value must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hsetnx(key, field, value))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hsetnx(key, field, value))); return null; } return getConnection().hsetnx(key, field, value); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Nullable @Override public Long hStrLen(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.newLettuceResult(getAsyncConnection().hstrlen(key, field))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hstrlen(key, field))); return null; } return getConnection().hstrlen(key, field); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public void hMSet(byte[] key, Map<byte[], byte[]> hashes) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(hashes, "Hashes must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceStatusResult(getAsyncConnection().hmset(key, hashes))); return; } if (isQueueing()) { transaction(connection.newLettuceStatusResult(getAsyncConnection().hmset(key, hashes))); return; } getConnection().hmset(key, hashes); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hincrbyfloat(key, field, delta))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hincrbyfloat(key, field, delta))); return null; } return getConnection().hincrbyfloat(key, field, delta); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hexists(key, field))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hexists(key, field))); return null; } return getConnection().hexists(key, field); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hget(key, field))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hget(key, field))); return null; } return getConnection().hget(key, field); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hdel(key, fields))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hdel(key, fields))); return null; } return getConnection().hdel(key, fields); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hincrby(key, field, delta))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hincrby(key, field, delta))); return null; } return getConnection().hincrby(key, field, delta); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Map<byte[], byte[]> hGetAll(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hgetall(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hgetall(key))); return null; } return getConnection().hgetall(key); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Long hLen(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hlen(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hlen(key))); return null; } return getConnection().hlen(key); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public List<byte[]> hVals(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hvals(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hvals(key))); return null; } return getConnection().hvals(key); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hmget(key, fields), LettuceConverters.keyValueListUnwrapper())); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hmget(key, fields), LettuceConverters.keyValueListUnwrapper())); return null; } return LettuceConverters.<byte[], byte[]> keyValueListUnwrapper().convert(getConnection().hmget(key, fields)); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Set<byte[]> hKeys(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hkeys(key), LettuceConverters.bytesListToBytesSet())); return null; } if (isQueueing()) { transaction( connection.newLettuceResult(getAsyncConnection().hkeys(key), LettuceConverters.bytesListToBytesSet())); return null; } return LettuceConverters.toBytesSet(getConnection().hkeys(key)); } catch (Exception ex) { throw convertLettuceAccessException(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.newLettuceResult(getAsyncConnection().hexists(key, field))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hexists(key, field))); return null; } return getConnection().hexists(key, field); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public void hMSet(byte[] key, Map<byte[], byte[]> hashes) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(hashes, "Hashes must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceStatusResult(getAsyncConnection().hmset(key, hashes))); return; } if (isQueueing()) { transaction(connection.newLettuceStatusResult(getAsyncConnection().hmset(key, hashes))); return; } getConnection().hmset(key, hashes); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Long hLen(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hlen(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hlen(key))); return null; } return getConnection().hlen(key); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public List<byte[]> hVals(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hvals(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hvals(key))); return null; } return getConnection().hvals(key); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Map<byte[], byte[]> hGetAll(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hgetall(key))); return null; } if (isQueueing()) { transaction(connection.newLettuceResult(getAsyncConnection().hgetall(key))); return null; } return getConnection().hgetall(key); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
@Override public Set<byte[]> hKeys(byte[] key) { Assert.notNull(key, "Key must not be null!"); try { if (isPipelined()) { pipeline(connection.newLettuceResult(getAsyncConnection().hkeys(key), LettuceConverters.bytesListToBytesSet())); return null; } if (isQueueing()) { transaction( connection.newLettuceResult(getAsyncConnection().hkeys(key), LettuceConverters.bytesListToBytesSet())); return null; } return LettuceConverters.toBytesSet(getConnection().hkeys(key)); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }