MCPcopy Create free account
hub / github.com/devfeel/dotweb / GetInt

Method GetInt

cache/runtime/cache_runtime.go:76–88  ·  view source on GitHub ↗

returns value int format by given key if non-existed or expired, return 0.

(key string)

Source from the content-addressed store, hash-verified

74// returns value int format by given key
75// if non-existed or expired, return 0.
76func (ca *RuntimeCache) GetInt(key string) (int, error) {
77 v, err := ca.GetString(key)
78 if err != nil || v == "" {
79 return 0, err
80 } else {
81 i, e := strconv.Atoi(v)
82 if e != nil {
83 return 0, e
84 } else {
85 return i, nil
86 }
87 }
88}
89
90// returns value int64 format by given key
91// if non-existed or expired, return 0.

Callers 2

TestRuntimeCache_IncrFunction · 0.95
TestRuntimeCache_DecrFunction · 0.95

Calls 1

GetStringMethod · 0.95

Tested by 2

TestRuntimeCache_IncrFunction · 0.76
TestRuntimeCache_DecrFunction · 0.76