returns value int format by given key if non-existed or expired, return 0.
(key string)
| 74 | // returns value int format by given key |
| 75 | // if non-existed or expired, return 0. |
| 76 | func (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. |