©
本文档使用
php中文网手册 发布
(PECL tokyo_tyrant >= 0.1.0)
TokyoTyrant::add — Adds to a numeric key
$key
, number $increment
[, int $type = 0
] )Adds to an int or double value. This increments the value by the given amount and returns the new value. If the key does not exist a new key is created with initial value of the increment parameter.
key The string key
increment The amount to increment
type TokyoTyrant::RDBREC_INT or TokyoTyrant::RDBREC_DBL constant.
If this parameter is omitted the type is guessed from the increment
parameters type.
Returns the new value on success
Example #1 TokyoTyrant::add() example
<?php
$tt = new TokyoTyrant ( "localhost" , TokyoTyrant :: RDBDEF_PORT );
$tt -> add ( "test" , 3 );
echo $tt -> add ( "test" , "3.5" , TokyoTyrant :: RDBREC_DBL );
?> 以上例程的输出类似于:
6.5