ttl return -1 if key does not have an associated expire but return -2 if key does not exists

This commit is contained in:
Nykolas Lima
2014-10-03 13:57:34 -03:00
parent ebaba79119
commit a3422bd898

View File

@@ -1,14 +1,21 @@
package redis.clients.jedis; package redis.clients.jedis;
import java.net.URI;
import java.util.AbstractMap;
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.Map.Entry;
import java.util.Set;
import redis.clients.jedis.BinaryClient.LIST_POSITION; import redis.clients.jedis.BinaryClient.LIST_POSITION;
import redis.clients.util.Pool; import redis.clients.util.Pool;
import redis.clients.util.SafeEncoder; import redis.clients.util.SafeEncoder;
import redis.clients.util.Slowlog; import redis.clients.util.Slowlog;
import java.net.URI;
import java.util.*;
import java.util.Map.Entry;
public class Jedis extends BinaryJedis implements JedisCommands, public class Jedis extends BinaryJedis implements JedisCommands,
MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands,
BasicCommands, ClusterCommands { BasicCommands, ClusterCommands {
@@ -310,8 +317,9 @@ public class Jedis extends BinaryJedis implements JedisCommands,
* *
* @param key * @param key
* @return Integer reply, returns the remaining time to live in seconds of a * @return Integer reply, returns the remaining time to live in seconds of a
* key that has an EXPIRE. If the Key does not exists or does not * key that has an EXPIRE.
* have an associated expire, -1 is returned. * If the Key does not have an associated expire, -1 is returned.
* If the Key does not exists, -2 is returned.
*/ */
public Long ttl(final String key) { public Long ttl(final String key) {
checkIsInMulti(); checkIsInMulti();