returns value string format by given key if non-existed or expired, return "".
(key string)
| 63 | // returns value string format by given key |
| 64 | // if non-existed or expired, return "". |
| 65 | func (ca *RuntimeCache) GetString(key string) (string, error) { |
| 66 | v, err := ca.Get(key) |
| 67 | if err != nil || v == nil { |
| 68 | return "", err |
| 69 | } else { |
| 70 | return fmt.Sprint(v), nil |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // returns value int format by given key |
| 75 | // if non-existed or expired, return 0. |