Home > php教程 > php手册 > php中操作memcached缓存进行增删改查数据的实现代码

php中操作memcached缓存进行增删改查数据的实现代码

WBOY
Release: 2016-06-06 20:19:31
Original
1477 people have browsed it

这篇文章主要介绍了php中操作memcached缓存进行增删改查数据的实现代码,需要的朋友可以参考下

核心代码:

connect("127.0.0.1",11211)){ die('连接失败'); } if($memcache->set('key1',"xian",MEMCACHE_COMPRESSED,60)){ echo 'sucess!'; }//存值,其中xian字符串,也可以为数组,对象,,但不能为资源 $val = $memcache->get('key1');//查询获取值 echo $val; $memcache->replace('key1','beijing',MEMCACHE_COMPRESSED,60);//修改 $memcache->delete('key1');//删除 ?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template