public function cachesql($blockname, $sql, $cachetime=0, $is_perpage=0, $limit_or_perpage=10, $limit_start=0, $pagetype='other', $usetype='other', $shopid=0, $infoid=0, $extra=array()) {
if($blockname && $sql) {
$blockcodearr = array();
$limit_or_perpage = intval($limit_or_perpage)>0?intval($limit_or_perpage):10;
$limit_start = intval($limit_start);
$cachetime = intval($cachetime)>0?intval($cachetime):0;
$sql = getblocksql($sql);
$blockcodearr[] = 'sql/'.rawurlencode($sql);
if($is_perpage) {
$blockcodearr[] = 'perpage/'.$limit_or_perpage;
} else {
$blockcodearr[] = 'limit/'.$limit_start.','.$limit_or_perpage;
}
$cachetime && $blockcodearr[] = 'cachetime/'.$cachetime;
$blockcodearr[] = 'cachename/'.rawurlencode($blockname);
$blockcodearr[] = 'pagetype/'.rawurlencode($pagetype);
$blockcodearr[] = 'usetype/'.rawurlencode($usetype);
$blockcodearr[] = 'shopid/'.intval($shopid);
$blockcodearr[] = 'infoid/'.intval($infoid);
if($extra) {
$blockcodearr[] = 'extra/'.addslashes(rawurlencode(serialize($extra)));
}
$returnst = block('sql', implode('/', $blockcodearr));
if($this->allowcache) {
return $returnst;
} else {
return false;
}
} else {
return false;
}
}
上面这个方法是upload/source/class/data_cache.class.php文件的一个方法,
$cachetime 是缓存时间,但是调用时设置是缓存5秒的,怎么好像没起作用,
<!--{eval $__item=$_BCACHE->cachesql('goodsinfo', "select itemid,shopid,subject,subjectimage from brand_gooditems where subjectimage <> '' order by rand() limit 5", 5, 0, 5, 0);}-->
我是这样调用的,
然后把这些数据推送到论坛里面,这些数据推送到论坛后需要刷新一个品牌空间的后台缓存论坛页面才更新,不刷新的话,就不更新,,,,知道的说下谢谢啦,,,,
|