Fork me on GitHub

Lesti::Fpc is internal full page cache for Magento.logo-450x450 This Cache needs no varnish or any other extenal software and works with events. It is an internal cache and so it replaces dynamic blocks before sending response to customer. Here is little post that explains the workflow of Lesti::Fpc.

Which pages can be cached?

Per default is caches:

  • cms_index_index
  • cms_page_index
  • catalog_product_view
  • catalog_category_view

You can add your own layout-handles in the configurations.

Which blocks are dynamic or lazy?

Per default are the following dynamic blocks:

  • global_messages
  • messages
  • right.reports.product.viewed
  • global_notices

Per default are the following lazy blocks:

  • top.links
  • cart_sidebar
  • catalog.compare.sidebar
  • wishlist_sidebar
  • welcome (Magento >= 1.8, for Magento 1.7 please read this post)

You can add your own dynamic block in the configurations (only blocks without children). Here you can find a explanation what dynamic and lazy blocks are. If you don’t know the name of your block in magento, here is a little post about it.

How to refresh lazy blocks?

The following actions refresh the lazy blocks:

  • checkout_cart_add
  • checkout_cart_delete
  • checkout_cart_updatePost
  • catalog_product_compare_add
  • catalog_product_compare_clear
  • catalog_product_compare_remove
  • wishlist_index_add
  • wishlist_index_remove
  • wishlist_index_update
  • wishlist_index_allcart
  • wishlist_index_configure

You can add your own refresh actions in the configurations. If you think I missed some default one, please contact me.

What about uri-params?

The following uri-params can be handled per default:

  • id
  • category
  • page_id
  • p
  • limit
  • dir
  • order
  • mode

There is a little post to explain uri parameters. You can add your own params in the configurations. If your layered navigation don’t work, please read this post.

Want to miss some requests?

These are the default miss uri params:

  • no_cache=1
  • limit=/[0-9]+/
  • dir=/[0-9a-z_]+/
  • order=/[0-9a-z_]+/
  • mode=/[0-9a-z_]+/
  • ___store=/[a-z]{1}[0-9a-z_]*/

If you didn’t want to cache a request you just have to add a parameter. here is a post that explains it.

The following session-params can be handled per default:

  • limit_page
  • sort_order
  • sort_direction
  • display_mode

You can add your own params in the configurations

Excluding a category, product or cms-page

You can exclude for example a category with id 25, by adding CATEGORY_25 to Bypass Handles in the configs of FPC.

What about multistore, multicurrency, mobilethemes and customergroups?

Lesti::Fpc can handle multistore, multicurrency, mobilethemes and different Prices for different customergroups.

What about cache lifetime?

Per default is the lifetime of a page 24 hours. You can edit under in app/etc/fpc.xml. Pages will be flushed after save of product, category, cms-page and cms-block.

Filecache gets too big?

You can compress the cached data with gzcompress from level 0 to 9.

What about apc, memcached, redis and so on?

You can set every other cachebackend like apc, memcached or redis in app/etc/fpc.xml. In the same style you did it in app/etc/local.xml. For redis you need Cm_Cache_Backend_Redis from Colin Mollenhour.

Where are the configurations?

You can refresh, disable or enable hole Cache under System => Cache Management. The configurations are under System => Configuration => Advanced => System => Lesti FPC.

Magento Version?

Lesti_Fpc is compatible with Magento CE 1.5, 1.6, 1.6.1,, 1.7, 1.8, 1.8.1, 1.9

Possible conflicts?

Lesti::Fpc rewrites the block core/messages.

Here is a list of people that know how to deal with Lesti::Fpc and can give paid support.

740 thoughts on “Lesti::Fpc”

  1. Hi Gordon,

    Great extension!

    We are having issues with M2E Pro. Is there anyway we can exclude M2E Pro from this FPC?

    Or any other solution?


      1. Hi Gordon,

        Probably you are familiar with M2Epro extension already. It’s to integrate Magento stores to eBay or Amazon.

        So basically when we add products to the M2EPro in order to list them on Amazon or eBay, we need to follow 4 or 5 steps. Most of the time after 3rd or 4th page it sends us back to step one.

        The guys from M2EPro had a look and told FPC is causing this.


        Ps: Have you considered using this WP plugin to your site?


        I believe it would be hugely helpful for everyone!

  2. Hi Gordon,

    This is a great extension!

    One question, If I use apc as cache backend, do I need to set it both fpc.xml and local.xml?


  3. hi

    and thank you for this great open source FPC!

    I don’t understand why but cache seems to be http client-specific
    eg: display home page with browser X > no cache used
    refresh page > cache used
    display same page, same URL… with browser Y > no cache used
    refresh page > new cache used

    Magento CE (cache = APC ; all caches activated ; compilation enabled)
    Last version of FPC (cache = CM cache backend file)

    FPC config:
    cms_index_index is in cachable actions
    some dynamic blocks
    no refresh actions / bypass handles / lazy blocks / session params / customer group caching / use of recent products viewed / gz compress
    default URI params
    only “no_cache” in miss URI params

    any idea what could cause this?



      1. hi

        and thanks for your answer
        indeed, I planned to log some datas ;)

        just as a reminder: in Magento back office, I removed everything in “session params”
        this is the “problem” for your script:

        _getParams() calls _getSessionParams()

        in _getSessionParams(), $params is empty, which is correct
        but the following is returned by this method:
        [0] =>

        so, in _getParams(), $sessionParams =
        [0] =>

        and $catalogSession[‘_data’] =
        [_session_validator_data] => Array
        [remote_addr] => ...my-ip...
        [http_via] =>
        [http_x_forwarded_for] =>
        [http_user_agent] => ...my-user-agent...

        [session_hosts] => Array
        [...the-host...] => 1

        [messages] => Mage_Core_Model_Message_Collection Object
        [_messages:protected] => Array

        [_lastAddedMessage:protected] =>


        the script enters the foreach loop
        $param is empty
        $catalogSession->getData($param) means the whole array as $param is empty
        so, after this foreach loop, $params contains a new entry “session_” which is equivalent to $catalogSession[‘_data’]

        so $params contains IP + user-agent, so the cache is HTTP client specific

        => in getCacheableActions(), getBypassHandles(), getRefreshActions(), _getUriParams(), _getSessionParams() and _getMissUriParams() you should check if $params is not empty before applying explode/trim/unique

  4. Ciao Gordon,
    this is a fantastic extension!

    One question:

    If I don’t have redis/apc/… can I ignore fpc.xml or I still have to put it in app/etc?

    Grazie, Fabio.

      1. Ciao Gordon, I’ve put direct in my header.phtml this code:

        <a href="getCartUrl(); ?>”>
        getItemsCount(); ?>
        __(‘Articles’) ?>
        Tot. getLocale()->currency(Mage::app()->getStore()-> getCurrentCurrencyCode())->getSymbol() ?>
        getQuote()->getGrandTotal(),2); ?>

        And of course it does not update.

        This code is placed directly because I’m not very good at programming…

        Can you help me?

          1. Ciao Gordon,
            another question.

            When is not present fpc.xml , how much is the default lifetime?

            I ask this because I’ve flushed the cache at evening (11pm) and check age of pages in the morning (8am). Some of those have age not 0…. very strange.

            There is something of internal scheduled functions that can flush Fpc? Like DataFeedManager for Google Shopping or functions to create sitemap?

  5. Seeing the same Fatal error: Call to a member function addMessages() on a non-object in /includes/src/__default.php on line 14241 even when adding from Github. It appeared to work, but when I merged css and js files I got this error. I tried manually removing the setting in the database, but it didnt make a difference. I also removed all added files and still see the issue. Flushed the caches in /var/cache and /var/session not sure what to do from here….

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>