Home  >  Article  >  Backend Development  >  How to test memcached in PHP

How to test memcached in PHP

不言
不言Original
2018-07-04 17:27:062575browse

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(&#39;192.168.1.10&#39;) or die ("Could not connect Memcached Server");
	$memcache -> set (&#39;key&#39;,&#39;Connect Memcached Server sussucfull&#39;);
	$get = $memcache -> get(&#39;key&#39;);
	echo $get;
?>

2.mecached delete key

<?php
	$nemcache = new memcached;
	$memcache -> connetct(&#39;192.168.1.10&#39;) or die ("Could not connect Memcached Server");
	//$memcache -> set (&#39;key&#39;,&#39;Connect Memcached Server sussucfull&#39;);  //设置
	//$memcache -> replace(&#39;key&#39;,&#39;New Connect Memcached Server sussucfull&#39;);
	$memcache -> delete(&#39;key&#39;);	//删除
	$get = $memcache -> get(&#39;key&#39;);//查询
	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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn