+ add hsetNX to hash commands

+ add jedis and jredis impl for hsetNx
This commit is contained in:
Costin Leau
2010-11-09 18:18:05 +02:00
parent 0ae7385f45
commit eaffa54025
3 changed files with 20 additions and 0 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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 {