MCPcopy
hub / github.com/bradfitz/gomemcache / Decrement

Method Decrement

memcache/memcache.go:802–804  ·  view source on GitHub ↗

Decrement atomically decrements key by delta. The return value is the new value after being decremented or an error. If the value didn't exist in memcached the error is ErrCacheMiss. The value in memcached must be an decimal number, or an error will be returned. On underflow, the new value is capped

(key string, delta uint64)

Source from the content-addressed store, hash-verified

800// On underflow, the new value is capped at zero and does not wrap
801// around.
802func (c *Client) Decrement(key string, delta uint64) (newValue uint64, err error) {
803 return c.incrDecr("decr", key, delta)
804}
805
806func (c *Client) incrDecr(verb, key string, delta uint64) (uint64, error) {
807 var val uint64

Callers 1

testWithClientFunction · 0.80

Calls 1

incrDecrMethod · 0.95

Tested by 1

testWithClientFunction · 0.64