标签:
<?php /* * PHP Memcache - Increment / Decrement values in memcache */ $memcache = new Memcache; $memcache->connect(‘localhost‘, 11211) or die("Could not connect"); if (!$memcache->get(‘counter‘)) $memcache->add(‘counter‘, 1); else $memcache->set(‘counter‘, 1); echo "Current counter value : ".$memcache->get(‘counter‘)."<br />"; //increment counter by 3 $memcache->increment(‘counter‘, 3); echo "Current counter value : ".$memcache->get(‘counter‘)."<br />"; //decrement counter by 1 $memcache->decrement(‘counter‘, 1); echo "Current counter value : ".$memcache->get(‘counter‘)."<br />"; ?>
http://runnable.com/UnDK3UyD6ituAAAV/increment-decrement-values-in-memcache-for-php 摘自该网站
标签:
原文地址:http://www.cnblogs.com/iamlinz/p/4551230.html