decr 命令/方法/函数

对指定的KEY的值自减1(如果要自减指定的值,可以使用decrBy)


Parameters

key

value: value that will be substracted to key (only for decrBy)


Return value

INT the new value


Examples

$redis->decr('key1'); /* key1 didn't exists, set to 0 before the increment */

/* and now has the value -1  */

$redis->decr('key1'); /* -2 */

$redis->decr('key1'); /* -3 */