DATAREDIS-1103 - Support new KEEPTTL option of the SET operation
Original Pull Request: #562
This commit is contained in:
committed by
Christoph Strobl
parent
3920890c01
commit
232c8a5dd4
@@ -16,6 +16,7 @@
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.data.Offset.offset;
|
||||
import static org.springframework.data.redis.connection.BitFieldSubCommands.*;
|
||||
import static org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldIncrBy.Overflow.*;
|
||||
@@ -2466,4 +2467,19 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
.valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()))).containsExactly(100L,
|
||||
-56L);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1103
|
||||
public void setKeepTTL() {
|
||||
|
||||
long expireSeconds = 10;
|
||||
assertThat(clusterConnection.setEx(KEY_1_BYTES, expireSeconds, VALUE_2_BYTES));
|
||||
|
||||
assertThat(clusterConnection.get(KEY_1_BYTES)).isEqualTo(VALUE_2_BYTES);
|
||||
|
||||
assertThat(clusterConnection.set(KEY_1_BYTES, VALUE_2_BYTES, Expiration.persistent(), SetOption.upsert(), true));
|
||||
|
||||
long ttl = clusterConnection.ttl(KEY_1_BYTES);
|
||||
|
||||
assertThat(0 < ttl && ttl <= expireSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user