+ add hsetNX to hash commands
+ add jedis and jredis impl for hsetNx
This commit is contained in:
@@ -34,6 +34,8 @@ public interface RedisHashCommands {
|
||||
|
||||
Boolean hSet(String key, String field, String value);
|
||||
|
||||
Boolean hSetNX(String key, String field, String value);
|
||||
|
||||
String hGet(String key, String field);
|
||||
|
||||
List<String> hMGet(String key, String... fields);
|
||||
|
||||
@@ -329,6 +329,19 @@ public class JedisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean hSetNX(String key, String field, String value) {
|
||||
try {
|
||||
if (isQueueing()) {
|
||||
transaction.hsetnx(key, field, value);
|
||||
return null;
|
||||
}
|
||||
return JedisUtils.convertCodeReply(jedis.hsetnx(key, field, value));
|
||||
} catch (Exception ex) {
|
||||
throw convertJedisAccessException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String key) {
|
||||
try {
|
||||
|
||||
@@ -788,6 +788,11 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean hSetNX(String key, String field, String value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> hVals(String key) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user