Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1d426bf5
Commit
1d426bf5
authored
Mar 09, 2013
by
antirez
Browse files
Optimize inner loop of activeExpireCycle() for no-expires case.
parent
da2dd899
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
1d426bf5
...
@@ -644,9 +644,13 @@ void activeExpireCycle(void) {
...
@@ -644,9 +644,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...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment