support for new 'set' command (redis 2.6.12+)

This commit is contained in:
amitm
2013-05-13 12:40:24 +03:00
parent 62c30dfe8b
commit 24c6b7c867
8 changed files with 152 additions and 56 deletions

View File

@@ -1,19 +1,12 @@
package redis.clients.jedis;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import redis.clients.jedis.BinaryClient.LIST_POSITION;
import redis.clients.util.SafeEncoder;
import redis.clients.util.Slowlog;
import java.net.URI;
import java.util.*;
public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands {
public Jedis(final String host) {
super(host);
@@ -51,6 +44,23 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
return client.getStatusCodeReply();
}
/**
* Set the string value as value of the key. The string can't be longer than
* 1073741824 bytes (1 GB).
* @param key
* @param value
* @param nxxx NX|XX, NX -- Only set the key if it does not already exist.
* XX -- Only set the key if it already exist.
* @param expx EX|PX, expire time units: EX = seconds; PX = milliseconds
* @param time expire time in the units of {@param #expx}
* @return Status code reply
*/
public String set(final String key, final String value, final String nxxx, final String expx, final long time) {
checkIsInMulti();
client.set(key, value, nxxx, expx, time);
return client.getStatusCodeReply();
}
/**
* Get the value of the specified key. If the key does not exist the special
* value 'nil' is returned. If the value stored at key is not a string an