- My controller:
public function indexAction()
{
$typeTopics = $this->_getParam('type');
$select = $topics->prepareSelect( array($typeTopics=>0) );
$paginator = new Zend_Paginator( new Zend_Paginator_Adapter_DbTableSelect( $select ) );
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$paginator->setCurrentPageNumber( $this->getRequest()->getParam( 'page', 1 ) );
$paginator->setItemCountPerPage( 40 );
$paginator->setPageRange(32);
$this->view->paginator = $paginator;
}
- In Zend_Paginator added :
protected function _getCacheInternalId()
{
echo md5(serialize(array(
spl_object_hash($this->getAdapter()),
$this->getItemCountPerPage()
))).'
';
return md5(serialize(array(
spl_object_hash($this->getAdapter()),
$this->getItemCountPerPage()
)));
}
- I removed all cache
- Refresh page with url params:
/type/new/page/1: _getCacheInternalId return: 322da30ae524a49ef490e50e873ab732
/type/popular/page/1: _getCacheInternalId return: b787e582a878f61ec149875f5484cfd6
ok we have different hash
- I reload pages again and now paginator reading from cache:
/type/new/page/1: _getCacheInternalId return: b787e582a878f61ec149875f5484cfd6
/type/popular/page/1: _getCacheInternalId return: b787e582a878f61ec149875f5484cfd6
hash is the same for both urls, if disable cache everythings works good :(
Comments
Posted by Wolfgang Bertl (fame23) on 2010-07-13T12:09:37.000+0000
I have the same problem in 1.10.6.
I can't say why, but on a Windows 7 computer I get a different internal cache id but on a computer with linux debian I always get the same internal cache id.
Posted by Wolfgang Bertl (fame23) on 2010-07-13T12:47:18.000+0000
Edit: On the Windows 7 is PHP version 5.3.1 installed and on the linux debian PHP version 5.2.8. Is it possible, that the PHP version is the problem?
Posted by Martin Meißner (meisii) on 2010-08-18T05:40:54.000+0000
Have a look on my comment for issue ZF-9940. Caching should now working fine. This issue can be closed.
Posted by Ramon Henrique Ornelas (ramon) on 2010-08-20T17:15:19.000+0000
Fixed by ~bate] in revision [r22828.
Posted by Rich Tibbett (richt) on 2011-10-05T12:58:28.000+0000
I'm still observing this bug in the latest release.
I took a look in to this issue and managed to hack caching to work as expected in Zend_Paginator as follows (diff to trunk r24489):
Index: library/Zend/Paginator.php
--- library/Zend/Paginator.php (revision 24490) +++ library/Zend/Paginator.php (working copy) @@ -772,8 +772,10 @@ { $pageNumber = $this->normalizePageNumber($pageNumber);
@@ -794,7 +796,7 @@ }
Not sure if this is the solution but it worked for me.
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-17T02:53:33.000+0000
Reopened due to comments