MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Get

Method Get

internal/utils/counters/counter.go:99–108  ·  view source on GitHub ↗

Get value of key

(key uint64)

Source from the content-addressed store, hash-verified

97
98// Get value of key
99func (this *Counter[T]) Get(key uint64) T {
100 var index = int(key % this.countMaps)
101 this.locker.RLock(index)
102 defer this.locker.RUnlock(index)
103 var item = this.itemMaps[index][key]
104 if item.IsOk() {
105 return item.Sum()
106 }
107 return 0
108}
109
110// GetKey get value of string key
111func (this *Counter[T]) GetKey(key string) T {

Callers 3

GetKeyMethod · 0.95
TestCounter_IncreaseFunction · 0.45
TestCounter_GCFunction · 0.45

Calls 4

RLockMethod · 0.80
RUnlockMethod · 0.80
IsOkMethod · 0.45
SumMethod · 0.45

Tested by 2

TestCounter_IncreaseFunction · 0.36
TestCounter_GCFunction · 0.36