<?php
/**
* @author http://weibo.com/codersay
*
* 功能说明:真实数据出库压栈到memcache,
* 这里是结合thinkphp使用的,使用时请将该方法放到thinkphp中的某一个控制器中做为其一方法使用
*/
function getData($key) {
echo 'after 100s the memcache data expire will clear<br />';
$list = cache($key);
if(!$list) {
$handler = D('Form');
$list = $handler->where('id = '.$key)->select();
cache($key,$list);
echo 'select data,into memcache,return';
return $list;
}
echo 'select from memcache';
return $list;
}
mysql与memcache结合
最新推荐文章于 2021-11-17 15:40:04 发布