本文整理了Java中redis.clients.jedis.JedisCluster.hsetnx()
方法的一些代码示例,展示了JedisCluster.hsetnx()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JedisCluster.hsetnx()
方法的具体详情如下:
包路径:redis.clients.jedis.JedisCluster
类名称:JedisCluster
方法名:hsetnx
暂无
代码示例来源:origin: spring-projects/spring-data-redis
@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 {
return JedisConverters.toBoolean(connection.getCluster().hsetnx(key, field, value));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: net.oschina.j2cache/j2cache-core
@Override
public Long hsetnx(byte[] bytes, byte[] bytes1, byte[] bytes2) {
return cluster.hsetnx(bytes, bytes1, bytes2);
}
代码示例来源:origin: hhfcyong/xxxx-dubbo
/**
* 将哈希表 key 中的域 field 的值设置为 value ,当且仅当域 field 不存在
* 若域 field 已经存在,该操作无效
* 如果 key 不存在,一个新哈希表被创建并执行 HSETNX 命令
* @param key
* @param field
* @param value
* @return 设置成功,返回 1 ,如果给定域已经存在且没有操作被执行,返回 0
*/
public Long hsetnx(String key,String field,String value){
return jedisCluster.hsetnx(key, field, value);
}
/**
代码示例来源:origin: org.nutz/nutz-integration-jedis
public Long hsetnx(String key, String field, String value) {
return jedisCluster.hsetnx(key, field, value);
}
代码示例来源:origin: org.nutz/nutz-integration-jedis
public Long hsetnx(byte[] key, byte[] field, byte[] value) {
return jedisCluster.hsetnx(key, field, value);
}
代码示例来源:origin: jwpttcg66/redis-game-transaction
@Override
public boolean setHnxString(String key, String field, String value) throws Exception {
boolean flag = false;
try {
flag = (jedisCluster.hsetnx(key, field, value) != 0);
} catch (Exception e) {
logger.error(TimeUtil.getDateString(new Date()) + ":::::" + "setNxString" + key, e);
}
return flag;
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@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 {
return JedisConverters.toBoolean(connection.getCluster().hsetnx(key, field, value));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: apache/servicemix-bundles
@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 {
return JedisConverters.toBoolean(connection.getCluster().hsetnx(key, field, value));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: org.nanoframework/nano-orm-jedis
@Override
public boolean hsetByNX(final String key, final String field, final String value) {
Assert.hasText(key);
Assert.hasText(field);
Assert.hasText(value);
try {
return isSuccess(cluster.hsetnx(key, field, value));
} catch (final Throwable e) {
throw new RedisClientException(e.getMessage(), e);
}
}
代码示例来源:origin: yrain/smart-cache
/**
* hash.设值
* 如果key不存在,则新建.返回1
* 如果key存在,则取消新建,返回0
*/
public boolean hsetnx(Object key, Object field, Object value) {
if (null == key || null == field || null == value) {
return false;
}
if (cluster) {
return jedisCluster.hsetnx(serializeKey(key), serializeKey(field), serializeVal(value)) == 1;
} else {
return jedisOperator.hsetnx(serializeKey(key), serializeKey(field), serializeVal(value)) == 1;
}
}
内容来源于网络,如有侵权,请联系作者删除!