1 start_server
{tags
{"expire"}} {
2 test
{EXPIRE
- set timeouts multiple times
} {
12 test
{EXPIRE
- It should be still possible to
read 'x'
} {
17 test
{EXPIRE
- After
2.1 seconds the key should no longer be here
} {
19 list [r get x
] [r exists x
]
23 test
{EXPIRE
- write on expire should work
} {
31 test
{EXPIREAT
- Check
for EXPIRE alike behavior
} {
34 r expireat x
[expr [clock seconds
]+15]
38 test
{SETEX
- Set
+ Expire combo operation. Check
for TTL
} {
43 test
{SETEX
- Check value
} {
47 test
{SETEX
- Overwrite old key
} {
53 test
{SETEX
- Wait
for the key to expire
} {
59 test
{SETEX
- Wrong
time parameter
} {
60 catch {r setex z
-10 foo
} e
64 test
{PERSIST can undo an EXPIRE
} {
67 list [r ttl x
] [r persist x
] [r ttl x
] [r get x
]
70 test
{PERSIST returns
0 against non existing or non volatile keys
} {
72 list [r persist foo
] [r persist nokeyatall
]
75 test
{EXPIRE pricision is now the millisecond
} {
76 # This test is very likely to do a false positive if the
77 # server is under pressure, so if it does not work give it a few more
79 for {set j
0} {$j < 3} {incr j
} {
86 if {$a eq
{somevalue
} && $b eq
{}} break
91 test
{PEXPIRE
/PSETEX
/PEXPIREAT can
set sub-second expires
} {
92 # This test is very likely to do a false positive if the
93 # server is under pressure, so if it does not work give it a few more
95 for {set j
0} {$j < 3} {incr j
} {
97 r psetex x
100 somevalue
111 r pexpireat x
[expr ([clock seconds
]*1000)+100]
117 if {$a eq
{somevalue
} && $b eq
{} &&
118 $c eq
{somevalue
} && $d eq
{} &&
119 $e eq
{somevalue
} && $f eq
{}} break
124 test
{PTTL returns millisecond
time to live
} {
126 r setex x
1 somevalue
128 assert
{$ttl > 900 && $ttl <= 1000}
131 test
{Redis should actively expire keys incrementally
} {
137 # Redis expires random keys ten times every second so we are
138 # fairly sure that all the three keys should be evicted after