huguesalary / Magento-Varnish

This Magento extension provides a Real Full Page Caching for Magento powered by Varnish with support of Session-Based information caching (Cart, Customer Accounts, ...) via ESI includes
Other
95 stars 18 forks source link

Mage::registry() persistence for cached blocks #8

Closed huguesalary closed 7 years ago

huguesalary commented 12 years ago

The extension allows the developer to specify a list of mage::registry() keys (like current_product, current_category, etc.) to be saved in the redis cache when a block has been set as an ESI include.

The current implementation just serializes the content associated to the specified registry key. The problem is that a lot of Objects are not serializable. For example, the current_product key, containing a Mage_Catalog_Model_Product Object, also contains, inside of the Object, some SimpleXML instances. SimpleXML can't be serialize. In "older" versions of PHP, serializing SimpleXML object doesn't cause too much harm and just raises a Warning, but in more recent versions, an Exception is raised.

This exception is not currently caught and thus crashes the application.

Serializing the Mage::registry() keys and put them in cache to make them available between requests is not a good solution. Another more reliable and elegant solution must be found.