Tuesday 23 August 2016

Memcached: incr: Increment the value associated with the key

incr command is used to increment the value associated with the key.

Syntax

incr key increment
$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set 123 0 900 2
23
STORED
get 123    
VALUE 123 0 2
23
END
incr 123 10
33
get 123
VALUE 123 0 2
33
END

You will get "CLIENT_ERROR cannot increment or decrement non-numeric value", if the value associated with given key is not numeric.

set 123 0 900 2
ab
STORED
incr 123 1
CLIENT_ERROR cannot increment or decrement non-numeric value


Previous                                                 Next                                                 Home

No comments:

Post a Comment