How to test memcached in PHP

不言
Release: 2023-04-02 12:14:01
Original
2589 people have browsed it

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;
?>
Copy after login

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;
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template