]> git.saurik.com Git - redis.git/commitdiff
Added test to make sure Redis evicts expired keys actively (and not just in a lazy...
authorantirez <antirez@gmail.com>
Sat, 12 Nov 2011 10:27:38 +0000 (11:27 +0100)
committerantirez <antirez@gmail.com>
Sat, 12 Nov 2011 10:27:38 +0000 (11:27 +0100)
tests/unit/expire.tcl

index 6130e8429a3d857596664201c89583108fc83338..b88ff821918a6c4acd324b8b6109fa7708046470 100644 (file)
@@ -127,4 +127,18 @@ start_server {tags {"expire"}} {
         set ttl [r pttl x]
         assert {$ttl > 900 && $ttl <= 1000}
     }
+
+    test {Redis should actively expire keys incrementally} {
+        r flushdb
+        r psetex key1 500 a
+        r psetex key2 500 a
+        r psetex key3 500 a
+        set size1 [r dbsize]
+        # Redis expires random keys ten times every second so we are
+        # fairly sure that all the three keys should be evicted after
+        # one second.
+        after 1000
+        set size2 [r dbsize]
+        list $size1 $size2
+    } {3 0}
 }