@Override public Boolean renameNX(byte[] sourceKey, byte[] targetKey) { Assert.notNull(sourceKey, "Source key must not be null!"); Assert.notNull(targetKey, "Target key must not be null!"); if (ClusterSlotHashUtil.isSameSlotForAllKeys(sourceKey, targetKey)) { try { return JedisConverters.toBoolean(connection.getCluster().renamenx(sourceKey, targetKey)); } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0 && !exists(targetKey)) { restore(targetKey, 0, value); del(sourceKey); return Boolean.TRUE; } return Boolean.FALSE; }
@Override public Boolean renameNX(byte[] sourceKey, byte[] targetKey) { Assert.notNull(sourceKey, "Source key must not be null!"); Assert.notNull(targetKey, "Target key must not be null!"); if (ClusterSlotHashUtil.isSameSlotForAllKeys(sourceKey, targetKey)) { try { return JedisConverters.toBoolean(connection.getCluster().renamenx(sourceKey, targetKey)); } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0 && !exists(targetKey)) { restore(targetKey, 0, value); del(sourceKey); return Boolean.TRUE; } return Boolean.FALSE; }
@Override public Boolean renameNX(byte[] sourceKey, byte[] targetKey) { Assert.notNull(sourceKey, "Source key must not be null!"); Assert.notNull(targetKey, "Target key must not be null!"); if (ClusterSlotHashUtil.isSameSlotForAllKeys(sourceKey, targetKey)) { try { return JedisConverters.toBoolean(connection.getCluster().renamenx(sourceKey, targetKey)); } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0 && !exists(targetKey)) { restore(targetKey, 0, value); del(sourceKey); return Boolean.TRUE; } return Boolean.FALSE; }