Memcached::increment

(PECL memcached >= 0.1.0)

Memcached::increment锟斤拷锟斤拷锟斤拷值元锟截碉拷值

说锟斤拷

public Memcached::increment ( string $key [, int $offset = 1 ] ) : int

Memcached::increment()锟斤拷一锟斤拷锟斤拷值元锟斤拷锟斤拷锟接诧拷锟斤拷offset指锟斤拷锟侥达拷小锟斤拷 锟斤拷锟皆拷氐锟街碉拷锟斤拷锟斤拷锟街碉拷锟斤拷停锟斤拷锟斤拷锟斤拷锟轿�0锟斤拷锟斤拷锟斤拷锟皆拷夭锟斤拷锟斤拷锟�Memcached::increment()失锟杰★拷

锟斤拷锟斤拷

key

要锟斤拷锟斤拷值锟斤拷元锟截碉拷key锟斤拷

offset

要锟斤拷元锟截碉拷值锟斤拷锟接的达拷小锟斤拷

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷元锟截碉拷锟斤拷值 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷 锟斤拷锟絢ey锟斤拷锟斤拷锟斤拷Memcached::getResultCode()锟斤拷锟斤拷锟斤拷锟斤拷Memcached::RES_NOTFOUND锟斤拷

锟斤拷锟斤拷

Example #1 Memcached::increment() 示锟斤拷

<?php
$m 
= new Memcached();
$m->addServer('localhost'11211);

$m->set('counter'0);
$m->increment('counter');
$m->increment('counter'10);
var_dump($m->get('counter'));

$m->set('key''abc');
$m->increment('counter');
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

int(11)
string(1) "1"

锟轿硷拷