This article mainly introduces the method of testing memcached in PHP, which has certain reference value. Now I share it with everyone. Friends in need can refer to it
1.memcached generates key
<?php $nemcache = new memcached; $memcache -> connetct('192.168.1.10') or die ("Could not connect Memcached Server"); $memcache -> set ('key','Connect Memcached Server sussucfull'); $get = $memcache -> get('key'); echo $get; ?>
2.mecached delete key
<?php $nemcache = new memcached; $memcache -> connetct('192.168.1.10') or die ("Could not connect Memcached Server"); //$memcache -> set ('key','Connect Memcached Server sussucfull'); //设置 //$memcache -> replace('key','New Connect Memcached Server sussucfull'); $memcache -> delete('key'); //删除 $get = $memcache -> get('key');//查询 echo $get; ?>
The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to PHP Chinese net!
Related recommendations:
Introduction to installing xhprof for performance analysis in PHP 7.1
php How to add the instant push function
The above is the detailed content of How to test memcached in PHP. For more information, please follow other related articles on the PHP Chinese website!