MCPcopy Create free account
hub / github.com/kataras/iris / Increment

Method Increment

sessions/session.go:267–272  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
267func (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.

Callers 3

GetMethod · 0.45
GetMethod · 0.45
IndexFunction · 0.45

Calls 2

GetIntDefaultMethod · 0.95
SetMethod · 0.95

Tested by

no test coverage detected