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

Method Get

cache/runtime/cache_runtime.go:51–60  ·  view source on GitHub ↗

Get cache from runtime cache. if non-existed or expired, return nil.

(key string)

Source from the content-addressed store, hash-verified

49// Get cache from runtime cache.
50// if non-existed or expired, return nil.
51func (ca *RuntimeCache) Get(key string) (interface{}, error) {
52 if itemObj, ok := ca.items.Load(key); ok {
53 item := itemObj.(*RuntimeItem)
54 if item.isExpire() {
55 return nil, nil
56 }
57 return item.value, nil
58 }
59 return nil, nil
60}
61
62
63// returns value string format by given key

Callers 5

GetStringMethod · 0.95
TestRuntimeCache_GetFunction · 0.95
TestRuntimeCache_DeleteFunction · 0.95

Calls 1

isExpireMethod · 0.80

Tested by 4

TestRuntimeCache_GetFunction · 0.76
TestRuntimeCache_DeleteFunction · 0.76