You need to sign in or sign up before continuing.
Commit 762eea07 authored by antirez's avatar antirez
Browse files

Added test to make sure Redis evicts expired keys actively (and not just in a lazy fashion).

parent 4be855e7
...@@ -127,4 +127,18 @@ start_server {tags {"expire"}} { ...@@ -127,4 +127,18 @@ start_server {tags {"expire"}} {
set ttl [r pttl x] set ttl [r pttl x]
assert {$ttl > 900 && $ttl <= 1000} 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}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment