indexArticle->getAll('content',$where,$page,$this->maxnum);}else ... PHPEye开源社区 关注全球PHP社区最新动态,研究专业PHP技术,推广国内PHP企业应用 - Discuz! Archiver">
PHPEye开源社区 » Zend Framework 使用讨论 » 请教:关于zend_cache的问题【以解决】
《Programming PHP》第二版上市
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]]

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.