mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Optimize inner loop of activeExpireCycle() for no-expires case.
This commit is contained in:
parent
5f5aa487f9
commit
1f7d2c1e27
10
src/redis.c
10
src/redis.c
@ -671,9 +671,13 @@ void activeExpireCycle(void) {
|
|||||||
/* Continue to expire if at the end of the cycle more than 25%
|
/* Continue to expire if at the end of the cycle more than 25%
|
||||||
* of the keys were expired. */
|
* of the keys were expired. */
|
||||||
do {
|
do {
|
||||||
unsigned long num = dictSize(db->expires);
|
unsigned long num, slots;
|
||||||
unsigned long slots = dictSlots(db->expires);
|
long long now;
|
||||||
long long now = mstime();
|
|
||||||
|
/* If there is nothing to expire try next DB ASAP. */
|
||||||
|
if ((num = dictSize(db->expires)) == 0) break;
|
||||||
|
slots = dictSlots(db->expires);
|
||||||
|
now = mstime();
|
||||||
|
|
||||||
/* When there are less than 1% filled slots getting random
|
/* When there are less than 1% filled slots getting random
|
||||||
* keys is expensive, so stop here waiting for better times...
|
* keys is expensive, so stop here waiting for better times...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user