Memcached::decrement

(PECL memcached >= 0.1.0)

Memcached::decrement锟斤拷小锟斤拷值元锟截碉拷值

说锟斤拷

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

Memcached::decrement()锟斤拷小一锟斤拷锟斤拷值元锟截碉拷值锟斤拷锟斤拷小锟斤拷锟斤拷锟缴诧拷锟斤拷offset锟斤拷锟斤拷锟斤拷 锟斤拷锟皆拷氐锟街碉拷锟斤拷锟斤拷锟街碉拷锟斤拷锟�0值锟皆达拷锟斤拷锟斤拷锟斤拷锟叫★拷锟斤拷值小锟斤拷0,锟斤拷锟铰碉拷值锟斤拷锟斤拷锟斤拷为0.锟斤拷锟皆拷夭锟斤拷锟斤拷冢锟�Memcached::decrement() 失锟杰★拷

锟斤拷锟斤拷

key

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

offset

要锟斤拷锟斤拷小指锟斤拷元锟截碉拷值锟斤拷小锟斤拷锟劫★拷

锟斤拷锟斤拷值

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

锟斤拷锟斤拷

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

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

$m->set('counter'5);
$m->decrement('counter');
var_dump($m->get('counter'));

$m->decrement('counter'10);
var_dump($m->get('counter'));
?>

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

int(4)
int(0)

锟轿硷拷