summaryrefslogtreecommitdiff
path: root/tests/unit/introspection-2.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-06-15 17:15:18 +0200
committerantirez <antirez@gmail.com>2016-06-15 17:15:51 +0200
commit3bd20ea2f1be58001dd6330a7763bed3d4221695 (patch)
tree4235294c4c7720b9580bb9eb4bbbc08d96af3710 /tests/unit/introspection-2.tcl
parent226f679651ca62394021738af0ce467a290c7b90 (diff)
downloadredis-3bd20ea2f1be58001dd6330a7763bed3d4221695.tar.gz
Test TOUCH and new TTL / TYPE behavior about object access time.
Diffstat (limited to 'tests/unit/introspection-2.tcl')
-rw-r--r--tests/unit/introspection-2.tcl23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/introspection-2.tcl b/tests/unit/introspection-2.tcl
new file mode 100644
index 000000000..350a8a016
--- /dev/null
+++ b/tests/unit/introspection-2.tcl
@@ -0,0 +1,23 @@
+start_server {tags {"introspection"}} {
+ test {TTL and TYPYE do not alter the last access time of a key} {
+ r set foo bar
+ after 3000
+ r ttl foo
+ r type foo
+ assert {[r object idletime foo] >= 2}
+ }
+
+ test {TOUCH alters the last access time of a key} {
+ r set foo bar
+ after 3000
+ r touch foo
+ assert {[r object idletime foo] < 2}
+ }
+
+ test {TOUCH returns the number of existing keys specified} {
+ r flushdb
+ r set key1 1
+ r set key2 2
+ r touch key0 key1 key2 key3
+ } 2
+}