Tuesday, 23 August 2016

Memcached: decr: Decrement the value associated with the key

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

Syntax
decr 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
decr 123 20
3
get 123
VALUE 123 0 2
3 
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
decr 123 10
CLIENT_ERROR cannot increment or decrement non-numeric value



Previous                                                 Next                                                 Home

No comments:

Post a Comment