File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
pkg/statistics/handle/cache/internal/lfu Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ func NewLFU(totalMemCost int64) (*LFU, error) {
86
86
return result , err
87
87
}
88
88
89
+ << << << < HEAD
90
+ == == == =
91
+ // adjustMemCost adjusts the memory cost according to the total memory cost.
92
+ // When the total memory cost is 0, the memory cost is set to 20% of the total memory.
93
+ func adjustMemCost (totalMemCost int64 ) (result int64 , err error ) {
94
+ if totalMemCost == 0 {
95
+ memTotal , err := memory .MemTotal ()
96
+ if err != nil {
97
+ return 0 , err
98
+ }
99
+ return int64 (memTotal * 20 / 100 ), nil
100
+ }
101
+ return totalMemCost , nil
102
+ }
103
+
104
+ >> >> >> > 9 d0fb303ede (statistics : stats cache set default quota as 20 % (#58013 ))
89
105
// Get implements statsCacheInner
90
106
func (s * LFU ) Get (tid int64 ) (* statistics .Table , bool ) {
91
107
result , ok := s .cache .Get (tid )
You can’t perform that action at this time.
0 commit comments