Simple Magento module to enable default product list block caching
PHP

README.md

St_ProductListBlockCache

Description

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.

Why would you install this?

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.

How much increase in performance can I expect?

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.

Results from Blackfire.io

Here are the results from Blackfire.io:

Cached category page

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.

Installation

Using modman

Make sure you have modman.

$ cd /path/to/your/magento
$ modman clone https://github.com/siment/St_ProductListBlockCache.git

Manual install

Download files and copy to your Magento root

Changelog

0.1.10

  1. Added form key used in "add to" links to cache key info of products list block. (Thank you, @p-makowski)

0.1.9

  1. Fixed typo in vendor name in composer.json

0.1.8

  1. Added composer.json to make module compatible with Composer installation.
  2. Syntax changes to modman.

0.1.7

Now supports language and currency switching:

  1. Added locale code to cache key info
  2. Added currency code to cache key info

0.1.6

  1. 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.
  2. Minor change to modman files.

0.1.5

  1. Initial commit. Basic functionality in place.