php-redis中文参考手册_incr_incrBy_incrByFloat_decr_de...

incr, incrBy

Description

Increment the number stored at key by one. If the second argument is filled, it will be used as the integer value of the increment.

对指定的KEY的值自增1。如何填写了第二个参数,将把第二个参数自增给KEY的值。

Parameters

key
value: value that will be added to key (only for incrBy)

Return value

INT the new value

返回新的INT数值

Examples
$redis->incr('key1'); /* key1 didn't exists, set to 0 before the increment */
                      /* and now has the value 1  */

$redis->incr('key1'); /* 2 */
$redis->incr('key1'); /* 3 */
$redis->incr('key1'); /* 4 */
$redis->incrBy('key1', 10); /* 14 */

incrByFloat

Description

Increment the key with floating point precision.

自增一个浮点型的数值。

Parameters

key
value: (float) value that will be added to the key

Return value

FLOAT the new value

Examples
$redis->incrByFloat('key1', 1.5); /* key1 didn't exist, so it will now be 1.5 */


$redis->incrByFloat('key1', 1.5); /* 3 */
$redis->incrByFloat('key1', -1.5); /* 1.5 */
$redis->incrByFloat('key1', 2.5); /* 3.5 */

decr, decrBy

Description

Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer value of the decrement.

对指定的KEY的值自减1。如何填写了第二个参数,将把第二个参数自减给KEY的值。
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 */
$redis->decrBy('key1', 10); /* -13 */

mGet, getMultiple

Description

Get the values of all the specified keys. If one or more keys dont exist, the array will contain FALSE at the position of the key.

取得所有指定KEYS的值,如果一个或者更多的KEYS不存在,那么返回的ARRAY中将在相应的KEYS的位置填充FALSE。

Parameters

Array: Array containing the list of the keys

数组:一个KEYS的数组

Return value

Array: Array containing the values related to keys in argument

数组:返回相应的KEYS的值

Examples
$redis->set('key1', 'value1');
$redis->set('key2', 'value2');
$redis->set('key3', 'value3');
$redis->mGet(array('key1', 'key2', 'key3')); /* array('value1', 'value2', 'value3');
$redis->mGet(array('key0', 'key1', 'key5')); /* array(`FALSE`, 'value2', `FALSE`);

你可能感兴趣的:(redis,PHP,phpredis,php-redis,中文参考手册)