本文整理了Java中redis.clients.jedis.Jedis.rename()
方法的一些代码示例,展示了Jedis.rename()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.rename()
方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:rename
[英]Atomically renames the key oldkey to newkey. If the source and destination name are the same an error is returned. If newkey already exists it is overwritten.
Time complexity: O(1)
[中]以原子方式将密钥oldkey重命名为newkey。如果源和目标名称相同,则返回错误。如果newkey已经存在,它将被覆盖。
时间复杂度:O(1)
代码示例来源:origin: apache/storm
@Override
public String rename(byte[] oldkey, byte[] newkey) {
return jedis.rename(oldkey, newkey);
}
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void command() {
jedis.select(db);
if(overwritten)
jedis.rename(oldKey, newKey);
else
result = jedis.renamenx(oldKey, newKey);
}
代码示例来源:origin: apache/storm
@Override
public String rename(String oldkey, String newkey) {
return jedis.rename(oldkey, newkey);
}
代码示例来源:origin: sohutv/cachecloud
@Override
public String execute(Jedis connection) {
return connection.rename(oldkey, newkey);
}
}.run(2, oldkey, newkey);
代码示例来源:origin: sohutv/cachecloud
@Override
public String execute(Jedis connection) {
return connection.rename(oldkey, newkey);
}
}.runBinary(2, oldkey, newkey);
代码示例来源:origin: jfinal/jfinal
/**
* 将 key 改名为 newkey 。
* 当 key 和 newkey 相同,或者 key 不存在时,返回一个错误。
* 当 newkey 已经存在时, RENAME 命令将覆盖旧值。
*/
public String rename(Object oldkey, Object newkey) {
Jedis jedis = getJedis();
try {
return jedis.rename(keyToBytes(oldkey), keyToBytes(newkey));
}
finally {close(jedis);}
}
代码示例来源:origin: spring-projects/spring-data-redis
@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!");
try {
if (isPipelined()) {
pipeline(connection.newStatusResult(connection.getRequiredPipeline().rename(sourceKey, targetKey)));
return;
}
if (isQueueing()) {
transaction(connection.newStatusResult(connection.getRequiredTransaction().rename(sourceKey, targetKey)));
return;
}
connection.getJedis().rename(sourceKey, targetKey);
} catch (Exception ex) {
throw connection.convertJedisAccessException(ex);
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public String execute(Jedis connection) {
return connection.rename(oldkey, newkey);
}
}.runBinary(2, oldkey, newkey);
代码示例来源:origin: apache/servicemix-bundles
@Override
public String execute(Jedis connection) {
return connection.rename(oldkey, newkey);
}
}.run(2, oldkey, newkey);
代码示例来源:origin: io.leopard/leopard-redis
@Override
public String rename(String oldkey, String newkey) {
return jedis.rename(oldkey, newkey);
}
代码示例来源:origin: io.leopard/leopard-redis
@Override
public String rename(String oldkey, String newkey) {
return jedis.rename(oldkey, newkey);
}
代码示例来源:origin: mindwind/craft-atom
private String rename0(Jedis j, String key, String newkey) {
return j.rename(key, newkey);
}
代码示例来源:origin: penggle/jedis-ms-sentinel
public String rename(byte[] oldkey, byte[] newkey) {
return master.rename(oldkey, newkey);
}
代码示例来源:origin: io.leopard/leopard-redis
@Override
public Object execute(Jedis jedis) {
String result = jedis.rename(oldkey, newkey);
return "OK".equalsIgnoreCase(result);
}
});
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public String rename(byte[] oldkey, byte[] newkey) {
String command = "rename";
return instrumented(command, () -> delegated.rename(oldkey, newkey));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public String rename(String oldkey, String newkey) {
String command = "rename";
return instrumented(command, () -> delegated.rename(oldkey, newkey));
}
代码示例来源:origin: AmadeusITGroup/HttpSessionReplacer
@Override
public String rename(byte[] oldkey, byte[] newkey) {
return jedis().rename(oldkey, newkey);
}
代码示例来源:origin: com.github.sogyf/goja-jfinal
/**
* 将 key 改名为 newkey 。
* 当 key 和 newkey 相同,或者 key 不存在时,返回一个错误。
* 当 newkey 已经存在时, RENAME 命令将覆盖旧值。
*/
public String rename(Object oldkey, Object newkey) {
Jedis jedis = getJedis();
try {
return jedis.rename(keyToBytes(oldkey), keyToBytes(newkey));
}
finally {close(jedis);}
}
代码示例来源:origin: yangfuhai/jboot
/**
* 将 key 改名为 newkey 。
* 当 key 和 newkey 相同,或者 key 不存在时,返回一个错误。
* 当 newkey 已经存在时, RENAME 命令将覆盖旧值。
*/
public String rename(Object oldkey, Object newkey) {
Jedis jedis = getJedis();
try {
return jedis.rename(keyToBytes(oldkey), keyToBytes(newkey));
} finally {
returnResource(jedis);
}
}
代码示例来源:origin: com.jfinal/jfinal
/**
* 将 key 改名为 newkey 。
* 当 key 和 newkey 相同,或者 key 不存在时,返回一个错误。
* 当 newkey 已经存在时, RENAME 命令将覆盖旧值。
*/
public String rename(Object oldkey, Object newkey) {
Jedis jedis = getJedis();
try {
return jedis.rename(keyToBytes(oldkey), keyToBytes(newkey));
}
finally {close(jedis);}
}
内容来源于网络,如有侵权,请联系作者删除!