从版本 1.1 >
xu yang编辑
在2022/04/27 12:12上
到版本
xu yang编辑
在2022/04/27 12:24上
>
修改评论 该版本没有评论

Summary

Details

Page properties
Content
... ... @@ -1,10 +1,12 @@
1 +get命令本质是调用了lookupKeyRead这个底层方法,
2 +lookupKeyRead方法如下:
3 +
1 1  {{plantuml}}
2 2  @startuml
3 3  start
4 4  
5 -:GET Command;
6 6  
7 -: lookupKeyRead();
9 +: lookupKeyReadWithFlags;
8 8  
9 9  
10 10  end
... ... @@ -11,15 +11,33 @@
11 11  @enduml
12 12  {{/plantuml}}
13 13  
16 +
17 +lookupKeyReadWithFlags方法如下:
18 +
14 14  {{plantuml}}
15 15  @startuml
16 16  start
17 17  
18 -:lookupKeyRead();
23 +if (调用expireIfNeeded方法判断key是否过期) then(1)
24 +if (当前环境为主节点) then(yes)
25 +:返回null;
26 +stop
27 +endif
19 19  
20 -: lookupKeyReadWithFlags();
29 +if (当前环境为从节点,并且命令为读的时候,那说明key过期是安全的) then(yes)
30 +:返回null;
31 +stop
32 +endif
33 +endif
21 21  
35 +:调用lookupKey方法,查询value的值;
36 +if (返回值为空) then(yes)
37 +:缓存命中+1;
22 22  
39 +endif
40 +
41 +:返回查询的结果;
42 +
23 23  end
24 24  @enduml
25 25  {{/plantuml}}