MCPcopy Index your code
hub / github.com/cppla/moto / loadBoostWinner

Function loadBoostWinner

controller/boost.go:34–43  ·  view source on GitHub ↗
(ruleName string)

Source from the content-addressed store, hash-verified

32}
33
34func loadBoostWinner(ruleName string) (string, bool, time.Time) {
35 if v, ok := boostWinnerCache.Load(ruleName); ok {
36 entry := v.(boostWinnerEntry)
37 if time.Now().Before(entry.expires) {
38 return entry.addr, true, entry.expires
39 }
40 boostWinnerCache.Delete(ruleName)
41 }
42 return "", false, time.Time{}
43}
44
45func storeBoostWinner(ruleName, addr string) {
46 // 简单的 size 控制:超过上限时随机淘汰一个(遍历首个)。

Callers 1

HandleBoostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected