标题: 请教:关于zend_cache的问题【以解决】
dudu
新手上路
Rank: 1



UID 1109
精华 0
积分 0
帖子 10
翻译 0
原创 0
阅读权限 10
注册 2008-5-2
状态 离线
发表于 2008-7-13 17:57  资料  短消息  加为好友 
请教:关于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');
        }



使用的是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);
        }



谢谢                  再次谢谢
                                                                                                       ---dudu

[ 本帖最后由 dudu 于 2008-7-13 18:10 编辑 ]

顶部
 


PHPEye开源社区


当前时区 GMT+8, 现在时间是 2008-11-21 17:28

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.010451 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - PHPEye开源社区 - Archiver