Zend_Paginator 和缓存。如何读取已发送到缓存的数据
我将数据注册到缓存,然后看到以下内容:
zend_cache---Zend_Paginator_1_42242d5fa3c4e4b7758810c276163e8a
但我无法读取。
$request = $this->getRequest();
$q = new Model();
$paginator = Zend_Paginator::factory($q->fetchAll());
$paginator->setCurrentPageNumber($request->getParam('p'));
$paginator->setItemCountPerPage(40);
$this->view->q = $paginator;
$fO = array('lifetime' => 3600, 'automatic_serialization' => true);
$bO = array('cache_dir'=> APPLICATION_PATH . '/cache/');
$cache = Zend_cache::factory('Core', 'File', $fO, $bO);
Zend_Paginator::setCache($cache);
I register the data to cache and I see the foliowing :
zend_cache---Zend_Paginator_1_42242d5fa3c4e4b7758810c276163e8a
but I can't read.
$request = $this->getRequest();
$q = new Model();
$paginator = Zend_Paginator::factory($q->fetchAll());
$paginator->setCurrentPageNumber($request->getParam('p'));
$paginator->setItemCountPerPage(40);
$this->view->q = $paginator;
$fO = array('lifetime' => 3600, 'automatic_serialization' => true);
$bO = array('cache_dir'=> APPLICATION_PATH . '/cache/');
$cache = Zend_cache::factory('Core', 'File', $fO, $bO);
Zend_Paginator::setCache($cache);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查数据库分析器是否已启用。 DB profiler 和 Zend_Paginator_Adapter_DbTableSelect 之间似乎存在冲突。
我还创建了一个新的 Paginator 类来扩展 Zend_Paginator ,并且修改了 getItemsByPage 函数。
这两行代码应添加在开头的
$pageNumber = $this->normalizePageNumber($pageNumber)
之后。Check to see if DB profiler is enabled. It seems that there is a conflict between DB profiler and Zend_Paginator_Adapter_DbTableSelect.
I've also created a new Paginator class that extends Zend_Paginator and I've modified getItemsByPage function.
These two lines of code should be added at the beggining, after
$pageNumber = $this->normalizePageNumber($pageNumber)
.