ZF-6746: Cache in Zend_Paginator not working

Issue Type: Bug Created: 2009-05-20T08:30:09.000+0000 Last Updated: 2009-08-17T23:15:04.000+0000 Status: Resolved Fix version(s): - 1.8.3 (09/Jun/09)

Reporter: julien PAULI (doctorrock83) Assignee: julien PAULI (doctorrock83) Tags: - Zend_Paginator

Related issues: Attachments:


Zend_Paginator makes cache ids from spl_object_hash($this), which changes throught HTTP request making Paginator unable to load its data back from cache, and also making it duplicate them in the cache.


Posted by Ionut Dinu (tunder) on 2009-05-27T05:47:10.000+0000

Related to "Zend_Paginator makes cache ids from spl_object_hash($this)":

it gives me same cache id for same adapter made from 2 different Zend_Db_Table_Select objects to test:

$table = new zend_db_tabe(); $select1 = $table->select()-where('some_field_1 = ?', 'some value'); $select2 = $table->select()-where('some_field_1 = ?', 'some other value');

$paginaor = new Zend_Paginator::Factory($select1); and $paginaor = new Zend_Paginator::Factory($select2);

return the same cache id, even though the results of the 2 selects are different.

Posted by Ionut Dinu (tunder) on 2009-05-28T03:45:32.000+0000

is it possible to cache the total number of items? I noticed that the select that counts the total number of items that need to be paginated is not cached.

Posted by julien PAULI (doctorrock83) on 2009-06-03T14:27:44.000+0000

Fixed in r15883 Warning, could lead to BC breaks with old cache entries as the tagging system has been reviewed and improved. Tests are welcome

Posted by Dane Horak (danehorak) on 2009-06-11T13:17:08.000+0000

When using Zend_Db_Profiler_Fierbug there are a few properties that store microtime values which when serializing the adapter cause it to produce a different hash value each time. Because this hash value is used to identify what cached data to load, Zend_Cache is unable to find any cache associated to this identifier.

Posted by ivan (ivan.veretelnyk) on 2009-08-17T15:19:56.000+0000

This cache stuff broken again in 1.9.1 Zend_Paginator_Adapter_DbTableSelect public function getItems($offset, $itemCountPerPage) { echo md5(serialize($this));echo "
"; $this->_select->limit($itemCountPerPage, $offset); echo md5(serialize($this));echo "
"; return $this->_select->getTable()->fetchAll($this->_select); }

this will show you issue, you will see two different strings and paginator will never load data from cache.

Posted by Jurrien Stutterheim (norm2782) on 2009-08-17T23:14:57.000+0000

Caching in Paginator is relatively tricky, which is one of the reasons why we didn't implement it initially.

ivan: Could you open a new issue for this?

julien: Do you want to look into this? Or shall I give it a go later today?

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.