2008-7-13 17:57
dudu
请教:关于zend_cache的问题【以解决】
[php] if (!($result = $this->cache->load('indexResult'))) {
if (!empty($caretoryid)) {
$where = "caretory_id=$caretoryid";
$result = $this->indexArticle->getAll('content',$where,$page,$this->maxnum);
}else {
$result = $this->indexArticle->getAll('content','',$page,$this->maxnum);
}
$this->cache->save($result,'indexResult');
}[/php]
使用的是Core
数据库查询通过不同的参数 返回不同的结果 但是这样用缓存的话 只要运行了一次 以后无论选那个参数 他还是返回第一次运行时的结果
请问这个通过 什么方式解决 或者说 我这种使用方式根本就是错的
还请各位 指点一下
修改后的
[php] if (!($result = $this->cache->load('indexResult'.$caretoryid))) {
if (!empty($caretoryid)) {
$where = "caretory_id=$caretoryid";
$result = $this->indexArticle->getAll('content',$where,$page,$this->maxnum);
}else {
$result = $this->indexArticle->getAll('content','',$page,$this->maxnum);
}
$this->cache->save($result,'indexResult'.$caretoryid);
}[/php]
谢谢 再次谢谢
---dudu
[[i] 本帖最后由 dudu 于 2008-7-13 18:10 编辑 [/i]]