nexcess/magento-turpentine — pull request #472 by jeroenvermeulen (2014-03-25 22:06:32+00:00)
Title: Added <only_cache_if> ESI param, now we can cache the messages blocks

Previously the messages ESI blocks were not cached because the "messages cleared" event is not reliable.

My solution is to cache the messages block only when it does not contain a message (`no_text`).
When a message needs to be communicated to the visitor the `core_session_abstract_add_message` event flushes the block. The block containing the message will not be cached because it does not get passed the `no_text` filter. During the next page visit an ESI request is passed to Magento, which serves an empty messages block, which can be cached again.

Being able to cache the `global_messages` and the `messages` blocks is a huge improvement, it highly reduces the number of hits on the Magento backend.

I have implemented `no_text` and `empty`.