Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2b4af919
提交
2b4af919
authored
8 年前
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LIRS cache: improved hit rate
上级
134a436d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
1 行删除
+12
-1
changelog.html
h2/src/docsrc/html/changelog.html
+3
-0
CacheLongKeyLIRS.java
h2/src/main/org/h2/mvstore/cache/CacheLongKeyLIRS.java
+7
-0
TestCacheLongKeyLIRS.java
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
+2
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
2b4af919
...
...
@@ -87,6 +87,9 @@ Change Log
when using larger databases and many threads.
To re-enable, use the file name prefix "cache:".
</li>
<li>
LIRS cache: improved hit rate because now added entries get hot if they
were in the non-resident part of the cache before.
</li>
</ul>
<h2>
Version 1.4.192 Beta (2016-05-26)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/cache/CacheLongKeyLIRS.java
浏览文件 @
2b4af919
...
...
@@ -791,9 +791,12 @@ public class CacheLongKeyLIRS<V> {
}
V
old
;
Entry
<
V
>
e
=
find
(
key
,
hash
);
boolean
existed
;
if
(
e
==
null
)
{
existed
=
false
;
old
=
null
;
}
else
{
existed
=
true
;
old
=
e
.
value
;
remove
(
key
,
hash
);
}
...
...
@@ -822,6 +825,10 @@ public class CacheLongKeyLIRS<V> {
mapSize
++;
// added entries are always added to the stack
addToStack
(
e
);
if
(
existed
)
{
// if it was there before (even non-resident), it becomes hot
access
(
key
,
hash
);
}
return
old
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
浏览文件 @
2b4af919
...
...
@@ -225,8 +225,9 @@ public class TestCacheLongKeyLIRS extends TestBase {
test
.
put
(
5
,
50
);
assertTrue
(
test
.
containsValue
(
50
));
verify
(
test
,
"mem: 4 stack: 5 4 3 2 cold: 5 non-resident: 1"
);
// 1 was non-resident, so this should make it hot
test
.
put
(
1
,
10
);
verify
(
test
,
"mem: 4 stack: 1 5 4 3
2 cold: 1
non-resident: 5"
);
verify
(
test
,
"mem: 4 stack: 1 5 4 3
cold: 2
non-resident: 5"
);
assertFalse
(
test
.
containsValue
(
50
));
test
.
remove
(
2
);
test
.
remove
(
3
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论