A simple module that adds cache information to Mage_Catalog_Block_Product_List
- thereby enabling block caching on
product lists.
This module was created for a tutorial on Minute.no.
Short answer:
Better performance.
Medium answer:
You might be familiar with Magento's block caching system. It is great. It works. Except it is barely enabled on a
default installation of Magento.
One of the most resource intensive templates in Magento is the category page. The dominant block on most category
pages is the product list block. Or Mage_Catalog_Block_Product_List
to be precise.
This module overrides Mage_Catalog_Block_Product_List
by adding some caching information which in turn will enable
caching for product lists. The product prices will be correct no matter who is logged in.
On Enterprise Edition with full page caching enabled: 0. Why? Because block caching is disabled while FPC is enabled.
On Community Edition: 2 x performance increase on cached category pages
The results are highly unscientific and is based on loading the accessories/shoes.html
page on a clean install of
Magento 1.9.1 with Magento's sample data installed.
Here are the results from Blackfire.io:
Measurement | Module disabled | Module enabled | Diff. in % |
---|---|---|---|
Wall Time | 1 s | 483 ms | - 52 % |
I/O | 103 ms | 27.8 ms | - 73 % |
CPU Time | 900 ms | 455 ms | - 49 % |
Memory | 37.1 MB | 33.4 MB | - 10 % |
This means that - roughly - your site will be able to render twice as many category pages per minute if this module is enabled.
Make sure you have modman.
$ cd /path/to/your/magento
$ modman clone https://github.com/siment/St_ProductListBlockCache.git
Download files and copy to your Magento root
- Added form key used in "add to" links to cache key info of products list block. (Thank you, @p-makowski)
- Fixed typo in vendor name in
composer.json
- Added
composer.json
to make module compatible with Composer installation. - Syntax changes to
modman
.
Now supports language and currency switching:
- Added locale code to cache key info
- Added currency code to cache key info
- Adding request URI to cache key to acommodate for filters and page numbers. It is not really that useful to have category page caching persist across URIs. I might improve on this later.
- Minor change to modman files.
- Initial commit. Basic functionality in place.