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
896e15f3
Commit
896e15f3
authored
Mar 24, 2014
by
Salvatore Sanfilippo
Browse files
Merge pull request #1627 from badboy/lru-fix
Fixed a few typos.
parents
68a3af5f
4fdd7a05
Changes
1
Show whitespace changes
Inline
Side-by-side
src/redis.c
View file @
896e15f3
...
@@ -2818,12 +2818,12 @@ void monitorCommand(redisClient *c) {
...
@@ -2818,12 +2818,12 @@ void monitorCommand(redisClient *c) {
* LRU approximation algorithm
* LRU approximation algorithm
*
*
* Redis uses an approximation of the LRU algorithm that runs in constant
* Redis uses an approximation of the LRU algorithm that runs in constant
* memory. Every time there is a key to expire, we sample
a
N keys (with
* memory. Every time there is a key to expire, we sample N keys (with
* N very small, usually in around 5) to populate a pool of best keys to
* N very small, usually in around 5) to populate a pool of best keys to
* evict of M keys (the pool size is defined by REDIS_EVICTION_POOL_SIZE).
* evict of M keys (the pool size is defined by REDIS_EVICTION_POOL_SIZE).
*
*
* The N keys sampled are added in the pool of good keys to expire (the one
* The N keys sampled are added in the pool of good keys to expire (the one
* with an old access time) if they are better th
e
n one of the current keys
* with an old access time) if they are better th
a
n one of the current keys
* in the pool.
* in the pool.
*
*
* After the pool is populated, the best key we have in the pool is expired.
* After the pool is populated, the best key we have in the pool is expired.
...
@@ -2901,7 +2901,7 @@ void evictionPoolPopulate(dict *sampledict, dict *keydict, struct evictionPoolEn
...
@@ -2901,7 +2901,7 @@ void evictionPoolPopulate(dict *sampledict, dict *keydict, struct evictionPoolEn
pool
[
k
].
key
&&
pool
[
k
].
key
&&
pool
[
k
].
idle
<
idle
)
k
++
;
pool
[
k
].
idle
<
idle
)
k
++
;
if
(
k
==
0
&&
pool
[
REDIS_EVICTION_POOL_SIZE
-
1
].
key
!=
NULL
)
{
if
(
k
==
0
&&
pool
[
REDIS_EVICTION_POOL_SIZE
-
1
].
key
!=
NULL
)
{
/* Can't insert i
s
the element is < the worst element we have
/* Can't insert i
f
the element is < the worst element we have
* and there are no empty buckets. */
* and there are no empty buckets. */
continue
;
continue
;
}
else
if
(
k
<
REDIS_EVICTION_POOL_SIZE
&&
pool
[
k
].
key
==
NULL
)
{
}
else
if
(
k
<
REDIS_EVICTION_POOL_SIZE
&&
pool
[
k
].
key
==
NULL
)
{
...
...
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