Increment increments the stored int value saved as "key" by +"n". If value doesn't exist on that "key" then it creates one with the "n" as its value. It returns the new, incremented, value.
(key string, n int)
| 265 | // If value doesn't exist on that "key" then it creates one with the "n" as its value. |
| 266 | // It returns the new, incremented, value. |
| 267 | func (s *Session) Increment(key string, n int) (newValue int) { |
| 268 | newValue = s.GetIntDefault(key, 0) |
| 269 | newValue += n |
| 270 | s.Set(key, newValue) |
| 271 | return |
| 272 | } |
| 273 | |
| 274 | // Decrement decrements the stored int value saved as "key" by -"n". |
| 275 | // If value doesn't exist on that "key" then it creates one with the "n" as its value. |
no test coverage detected