DATAREDIS-472 - Remove guards on pExpire & pSetEx in JedisConnection for values exceeding Integer.MAX_VALUE.
Remove guards and use native driver api for pexpire and psetex which is available in the current jedis distribution. Original Pull Request: #175 CLA: 165820160303082625 (Milan Agatonovic)
This commit is contained in:
committed by
Christoph Strobl
parent
1109c45096
commit
b630744564
@@ -91,6 +91,7 @@ import redis.clients.util.Pool;
|
||||
* @author Jungtaek Lim
|
||||
* @author Konstantin Shchepanovskyi
|
||||
* @author David Liu
|
||||
* @author Milan Agatonovic
|
||||
*/
|
||||
public class JedisConnection extends AbstractRedisConnection {
|
||||
|
||||
@@ -972,27 +973,16 @@ public class JedisConnection extends AbstractRedisConnection {
|
||||
|
||||
public Boolean pExpire(byte[] key, long millis) {
|
||||
|
||||
/*
|
||||
* @see DATAREDIS-286 to avoid overflow in Jedis
|
||||
*
|
||||
* TODO Remove this workaround when we upgrade to a Jedis version that contains a
|
||||
* fix for: https://github.com/xetorthio/jedis/pull/575
|
||||
*/
|
||||
if (millis > Integer.MAX_VALUE) {
|
||||
|
||||
return pExpireAt(key, time() + millis);
|
||||
}
|
||||
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
pipeline(new JedisResult(pipeline.pexpire(key, (int) millis), JedisConverters.longToBoolean()));
|
||||
pipeline(new JedisResult(pipeline.pexpire(key, millis), JedisConverters.longToBoolean()));
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(new JedisResult(transaction.pexpire(key, (int) millis), JedisConverters.longToBoolean()));
|
||||
transaction(new JedisResult(transaction.pexpire(key, millis), JedisConverters.longToBoolean()));
|
||||
return null;
|
||||
}
|
||||
return JedisConverters.toBoolean(jedis.pexpire(key, (int) millis));
|
||||
return JedisConverters.toBoolean(jedis.pexpire(key, millis));
|
||||
} catch (Exception ex) {
|
||||
throw convertJedisAccessException(ex);
|
||||
}
|
||||
@@ -1327,14 +1317,14 @@ public class JedisConnection extends AbstractRedisConnection {
|
||||
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
doPipelined(pipeline.psetex(key, (int) milliseconds, value));
|
||||
doPipelined(pipeline.psetex(key, milliseconds, value));
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
doQueued(transaction.psetex(key, (int) milliseconds, value));
|
||||
doQueued(transaction.psetex(key, milliseconds, value));
|
||||
return;
|
||||
}
|
||||
jedis.psetex(key, (int) milliseconds, value);
|
||||
jedis.psetex(key, milliseconds, value);
|
||||
} catch (Exception ex) {
|
||||
throw convertJedisAccessException(ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user