Merge pull request #641 from Lolecule/set_nxxx_expx_on_jedis_cluster

Added Set NXXX and EXPX options for JedisCluster and ShardedJedis
This commit is contained in:
Jonathan Leibiusky
2014-05-25 13:31:36 -04:00
3 changed files with 22 additions and 0 deletions

View File

@@ -44,6 +44,18 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}.run(key);
}
@Override
public String set(final String key, final String value, final String nxxx,
final String expx, final long time) {
return new JedisClusterCommand<String>(connectionHandler, timeout,
maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.set(key, value, nxxx, expx, time);
}
}.run(key);
}
@Override
public String get(final String key) {
return new JedisClusterCommand<String>(connectionHandler, timeout,

View File

@@ -10,6 +10,9 @@ import java.util.Set;
public interface JedisCommands {
String set(String key, String value);
String set(String key, String value, String nxxx,
String expx, long time);
String get(String key);
Boolean exists(String key);

View File

@@ -32,6 +32,13 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.set(key, value);
}
@Override
public String set(String key, String value, String nxxx,
String expx, long time) {
Jedis j = getShard(key);
return j.set(key, value, nxxx, expx, time);
}
public String get(String key) {
Jedis j = getShard(key);
return j.get(key);