@Override public String rename(String oldkey, String newkey) { return jedisCluster.rename(oldkey, newkey); }
@Override public String rename(byte[] oldkey, byte[] newkey) { return jedisCluster.rename(oldkey, newkey); }
@Override public void rename(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 { connection.getCluster().rename(sourceKey, targetKey); return; } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0) { restore(targetKey, 0, value); del(sourceKey); } }
public String rename(byte[] oldkey, byte[] newkey) { return jedisCluster.rename(oldkey, newkey); }
public String rename(String oldkey, String newkey) { return jedisCluster.rename(oldkey, newkey); }
/** * 将 key 改名为 newkey 。 * 当 key 和 newkey 相同,或者 key 不存在时,返回一个错误。 * 当 newkey 已经存在时, RENAME 命令将覆盖旧值。 */ public String rename(Object oldkey, Object newkey) { return jedisCluster.rename(keyToBytes(oldkey), keyToBytes(newkey)); }
@Override public void rename(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 { connection.getCluster().rename(sourceKey, targetKey); return; } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0) { restore(targetKey, 0, value); del(sourceKey); } }
@Override public void rename(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 { connection.getCluster().rename(sourceKey, targetKey); return; } catch (Exception ex) { throw convertJedisAccessException(ex); } } byte[] value = dump(sourceKey); if (value != null && value.length > 0) { restore(targetKey, 0, value); del(sourceKey); } }