summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-12-18 14:49:38 +0800
committerzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-12-18 15:20:36 +0800
commit24044f33560e9c34e73d8ffc493ed7c0b6b95dbc (patch)
treef3d6aca592a2c9231ffd369e9ac5d08c464f34ff /tests/unit
parentb7c78b7651c5458ccf5d95ef5857ec427b927a27 (diff)
downloadredis-24044f33560e9c34e73d8ffc493ed7c0b6b95dbc.tar.gz
add a new SET option KEEPTTL that doesn't remove expire time
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/expire.tcl13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/expire.tcl b/tests/unit/expire.tcl
index de24eabed..11fb82ef0 100644
--- a/tests/unit/expire.tcl
+++ b/tests/unit/expire.tcl
@@ -219,4 +219,17 @@ start_server {tags {"expire"}} {
set ttl [r ttl foo]
assert {$ttl <= 98 && $ttl > 90}
}
+
+ test {SET command will remove expire} {
+ r set foo bar EX 100
+ r set foo bar
+ r ttl foo
+ } {-1}
+
+ test {SET - use KEEPTTL option, TTL should not be removed} {
+ r set foo bar EX 100
+ r set foo bar KEEPTTL
+ set ttl [r ttl foo]
+ assert {$ttl <= 100 && $ttl > 90}
+ }
}