HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Memcached incr and decr command is used to key (key) numeric value already exists will be incrementing or subtraction operation.
Data incr and decr operation of the command must be a decimal 32-bit unsigned integer.
If the key does not exist returnNOT_FOUND, if the value of the key is not a number, the return CLIENT_ERROR,other errors returnERROR.
The basic syntax incr command is as follows:
incr key increment_value
Parameters are as follows:
In the following examples, we use visitors as key, an initial value of 10, followed by adding 5 operation.
set visitors 0 900 2 10 STORED get visitors VALUE visitors 0 2 10 END incr visitors 5 15 get visitors VALUE visitors 0 2 15 END
Output information Description:
The basic syntax decr command is as follows:
decr key decrement_value
Parameters are as follows:
set visitors 0 900 2 10 STORED get visitors VALUE visitors 0 2 10 END decr visitors 5 5 get visitors VALUE visitors 0 1 5 END
In the following examples, we use visitors as key, an initial value of 10, followed by minus 5 operation.
Output information Description: