EXPIRE replaced to PEXPIRE, EXPIREAT replaced to PEXPIREAT, TTL replaced to PTTL. #288

pull/337/head
Nikita 9 years ago
parent e4a325824b
commit b187b10376

@ -43,7 +43,7 @@ abstract class RedissonExpirable extends RedissonObject implements RExpirable {
@Override @Override
public Future<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) { public Future<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) {
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.EXPIRE, getName(), timeUnit.toSeconds(timeToLive)); return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.PEXPIRE, getName(), timeUnit.toSeconds(timeToLive));
} }
@Override @Override
@ -53,7 +53,7 @@ abstract class RedissonExpirable extends RedissonObject implements RExpirable {
@Override @Override
public Future<Boolean> expireAtAsync(long timestamp) { public Future<Boolean> expireAtAsync(long timestamp) {
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.EXPIREAT, getName(), timestamp); return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.PEXPIREAT, getName(), timestamp);
} }
@Override @Override
@ -83,7 +83,7 @@ abstract class RedissonExpirable extends RedissonObject implements RExpirable {
@Override @Override
public Future<Long> remainTimeToLiveAsync() { public Future<Long> remainTimeToLiveAsync() {
return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.TTL, getName()); return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.PTTL, getName());
} }
} }

@ -52,7 +52,7 @@ public interface RExpirableReactive extends RObjectReactive {
* Set an expire date for object in mode. When expire date comes * Set an expire date for object in mode. When expire date comes
* the key will automatically be deleted. * the key will automatically be deleted.
* *
* @param timestamp - expire date in seconds (Unix timestamp) * @param timestamp - expire date in milliseconds (Unix timestamp)
* @return <code>true</code> if the timeout was set and <code>false</code> if not * @return <code>true</code> if the timeout was set and <code>false</code> if not
*/ */
Publisher<Boolean> expireAt(long timestamp); Publisher<Boolean> expireAt(long timestamp);
@ -66,9 +66,11 @@ public interface RExpirableReactive extends RObjectReactive {
Publisher<Boolean> clearExpire(); Publisher<Boolean> clearExpire();
/** /**
* Get remaining time to live of object in seconds. * Get remaining time to live of object in milliseconds.
* *
* @return <code>-1</code> if object does not exist or time in seconds * @return time in milliseconds
* -2 if the key does not exist.
* -1 if the key exists but has no associated expire.
*/ */
Publisher<Long> remainTimeToLive(); Publisher<Long> remainTimeToLive();

@ -117,10 +117,10 @@ public interface RedisCommands {
RedisStrictCommand<Long> LLEN = new RedisStrictCommand<Long>("LLEN"); RedisStrictCommand<Long> LLEN = new RedisStrictCommand<Long>("LLEN");
RedisStrictCommand<Boolean> LTRIM = new RedisStrictCommand<Boolean>("LTRIM", new BooleanReplayConvertor()); RedisStrictCommand<Boolean> LTRIM = new RedisStrictCommand<Boolean>("LTRIM", new BooleanReplayConvertor());
RedisStrictCommand<Boolean> EXPIRE = new RedisStrictCommand<Boolean>("EXPIRE", new BooleanReplayConvertor()); RedisStrictCommand<Boolean> PEXPIRE = new RedisStrictCommand<Boolean>("PEXPIRE", new BooleanReplayConvertor());
RedisStrictCommand<Boolean> EXPIREAT = new RedisStrictCommand<Boolean>("EXPIREAT", new BooleanReplayConvertor()); RedisStrictCommand<Boolean> PEXPIREAT = new RedisStrictCommand<Boolean>("PEXPIREAT", new BooleanReplayConvertor());
RedisStrictCommand<Boolean> PERSIST = new RedisStrictCommand<Boolean>("PERSIST", new BooleanReplayConvertor()); RedisStrictCommand<Boolean> PERSIST = new RedisStrictCommand<Boolean>("PERSIST", new BooleanReplayConvertor());
RedisStrictCommand<Long> TTL = new RedisStrictCommand<Long>("TTL"); RedisStrictCommand<Long> PTTL = new RedisStrictCommand<Long>("PTTL");
RedisCommand<Object> RPOPLPUSH = new RedisCommand<Object>("RPOPLPUSH"); RedisCommand<Object> RPOPLPUSH = new RedisCommand<Object>("RPOPLPUSH");
RedisCommand<Object> BRPOPLPUSH = new RedisCommand<Object>("BRPOPLPUSH"); RedisCommand<Object> BRPOPLPUSH = new RedisCommand<Object>("BRPOPLPUSH");

@ -41,7 +41,7 @@ public interface RExpirable extends RObject, RExpirableAsync {
* Set an expire date for object. When expire date comes * Set an expire date for object. When expire date comes
* the key will automatically be deleted. * the key will automatically be deleted.
* *
* @param timestamp - expire date in seconds (Unix timestamp) * @param timestamp - expire date in milliseconds (Unix timestamp)
* @return <code>true</code> if the timeout was set and <code>false</code> if not * @return <code>true</code> if the timeout was set and <code>false</code> if not
*/ */
boolean expireAt(long timestamp); boolean expireAt(long timestamp);
@ -66,7 +66,7 @@ public interface RExpirable extends RObject, RExpirableAsync {
/** /**
* Remaining time to live of Redisson object that has a timeout * Remaining time to live of Redisson object that has a timeout
* *
* @return time in seconds * @return time in milliseconds
* -2 if the key does not exist. * -2 if the key does not exist.
* -1 if the key exists but has no associated expire. * -1 if the key exists but has no associated expire.
*/ */

@ -38,17 +38,17 @@ abstract class RedissonExpirableReactive extends RedissonObjectReactive implemen
@Override @Override
public Publisher<Boolean> expire(long timeToLive, TimeUnit timeUnit) { public Publisher<Boolean> expire(long timeToLive, TimeUnit timeUnit) {
return commandExecutor.writeReactive(getName(), StringCodec.INSTANCE, RedisCommands.EXPIRE, getName(), timeUnit.toSeconds(timeToLive)); return commandExecutor.writeReactive(getName(), StringCodec.INSTANCE, RedisCommands.PEXPIRE, getName(), timeUnit.toSeconds(timeToLive));
} }
@Override @Override
public Publisher<Boolean> expireAt(long timestamp) { public Publisher<Boolean> expireAt(long timestamp) {
return commandExecutor.writeReactive(getName(), StringCodec.INSTANCE, RedisCommands.EXPIREAT, getName(), timestamp); return commandExecutor.writeReactive(getName(), StringCodec.INSTANCE, RedisCommands.PEXPIREAT, getName(), timestamp);
} }
@Override @Override
public Publisher<Boolean> expireAt(Date timestamp) { public Publisher<Boolean> expireAt(Date timestamp) {
return expireAt(timestamp.getTime() / 1000); return expireAt(timestamp.getTime());
} }
@Override @Override
@ -58,7 +58,7 @@ abstract class RedissonExpirableReactive extends RedissonObjectReactive implemen
@Override @Override
public Publisher<Long> remainTimeToLive() { public Publisher<Long> remainTimeToLive() {
return commandExecutor.readReactive(getName(), StringCodec.INSTANCE, RedisCommands.TTL, getName()); return commandExecutor.readReactive(getName(), StringCodec.INSTANCE, RedisCommands.PTTL, getName());
} }
} }

Loading…
Cancel
Save