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