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,22 +1,16 @@
package redis.clients.jedis;
import static redis.clients.jedis.Protocol.toByteArray;
import java.net.URI;
import java.util.ArrayList;
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.jedis.exceptions.JedisDataException;
import redis.clients.jedis.exceptions.JedisException;
import redis.clients.util.JedisByteHashMap;
import redis.clients.util.SafeEncoder;
import java.net.URI;
import java.util.*;
import static redis.clients.jedis.Protocol.toByteArray;
public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKeyBinaryCommands, AdvancedBinaryJedisCommands, BinaryScriptingCommands {
protected Client client = null;
@@ -78,6 +72,23 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
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 byte[] key, final byte[] value, final byte[] nxxx, final byte[] 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