Get cache from runtime cache. if non-existed or expired, return nil.
(key string)
| 49 | // Get cache from runtime cache. |
| 50 | // if non-existed or expired, return nil. |
| 51 | func (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 |