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
53cea972
Commit
53cea972
authored
Oct 13, 2017
by
zhaozhao.zz
Committed by
antirez
Nov 27, 2017
Browse files
LFU: change lfu* parameters to int
parent
dfc42ec4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/evict.c
View file @
53cea972
...
@@ -334,7 +334,7 @@ uint8_t LFULogIncr(uint8_t counter) {
...
@@ -334,7 +334,7 @@ uint8_t LFULogIncr(uint8_t counter) {
unsigned
long
LFUDecrAndReturn
(
robj
*
o
)
{
unsigned
long
LFUDecrAndReturn
(
robj
*
o
)
{
unsigned
long
ldt
=
o
->
lru
>>
8
;
unsigned
long
ldt
=
o
->
lru
>>
8
;
unsigned
long
counter
=
o
->
lru
&
255
;
unsigned
long
counter
=
o
->
lru
&
255
;
if
(
LFUTimeElapsed
(
ldt
)
>=
server
.
lfu_decay_time
&&
counter
)
{
if
(
LFUTimeElapsed
(
ldt
)
>=
(
unsigned
long
)
server
.
lfu_decay_time
&&
counter
)
{
if
(
counter
>
LFU_INIT_VAL
*
2
)
{
if
(
counter
>
LFU_INIT_VAL
*
2
)
{
counter
/=
2
;
counter
/=
2
;
if
(
counter
<
LFU_INIT_VAL
*
2
)
counter
=
LFU_INIT_VAL
*
2
;
if
(
counter
<
LFU_INIT_VAL
*
2
)
counter
=
LFU_INIT_VAL
*
2
;
...
...
src/server.h
View file @
53cea972
...
@@ -1118,8 +1118,8 @@ struct redisServer {
...
@@ -1118,8 +1118,8 @@ struct redisServer {
unsigned
long
long
maxmemory
;
/* Max number of memory bytes to use */
unsigned
long
long
maxmemory
;
/* Max number of memory bytes to use */
int
maxmemory_policy
;
/* Policy for key eviction */
int
maxmemory_policy
;
/* Policy for key eviction */
int
maxmemory_samples
;
/* Pricision of random sampling */
int
maxmemory_samples
;
/* Pricision of random sampling */
unsigned
int
lfu_log_factor
;
/* LFU logarithmic counter factor. */
int
lfu_log_factor
;
/* LFU logarithmic counter factor. */
unsigned
int
lfu_decay_time
;
/* LFU counter decay factor. */
int
lfu_decay_time
;
/* LFU counter decay factor. */
/* Blocked clients */
/* Blocked clients */
unsigned
int
bpop_blocked_clients
;
/* Number of clients blocked by lists */
unsigned
int
bpop_blocked_clients
;
/* Number of clients blocked by lists */
list
*
unblocked_clients
;
/* list of clients to unblock before next loop */
list
*
unblocked_clients
;
/* list of clients to unblock before next loop */
...
...
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