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

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.

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

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.

578 thoughts on “Lesti::Fpc”

  1. 0 down vote favorite
    I’m would like to use lesti:FPC with a module I developed.
    To enable SEO friendly urls ALL requests to the module are sent to the module index action, and there a template is dynamically loaded. How can I make lesti:FPC work under this scenario?
    On the module indexAction I have:


    Would adding ‘addon_index’ to the lesti:FPC layout-handles be enough to get my module pages cached?

    Thank you so much.

    1. Hello,
      I’m sorry, but this won’t work. Why did you route all requests to index action? Please don’t do so, this isn’t the Magento way and I guess all Full Page Caches and many other popular Magento modules won’t work if you do so.

      Best Regards

      1. Hello Gordon,

        Thank you so much for replying. The reason why I routed all requests to the index action is to enable the module to handle different URLs written in a SEO-friendly format.

        As an example:

        Will all be handled by the module and display some dynamic content using template “model.phtml”

        In the same way:


        Will both be handled by the module and display some dinamic content using template “brand.phtml”

        As I mentioned the template is selected via business logic on the Index action controller doing:


        If there is no way to make lesti:FPC catch the pages given that set up, could you please suggest some modification to the module to make it work with lesti:FPC and still provide the SEO-friendly URL handling.

        Once again thank you for replying and thanks for your great work with lesti:FPC.

        Kind regards,

        1. Hello Otto,
          I guess there should be extensions that do the same. Please don’t route everything to one action. That breaks the way Magento works. You should never put logic into templates. Why didn’t you create categories for every brand?

          Best Regards

  2. Hi Gordon,

    Brilliant module, thank you for making this free to all. It should be part of the CE code base if you ask me!

    I was wondering if you have any suggestions for pre warming the cache?

  3. Thanks for your reply, really appreciate it.

    I have another question – what is the best way to handle using more than 1 front end servers without redis? is there any way to force lesti fpc to write to 1 specific server and read from both, so file replication can populate both servers? are the page cache entries always created witht he same naming architecture? ie, if you hit the home on web1 and the page is cached, would it have exactly the same name as if you then hit the home page on web2?

    1. $fpc->clean(sha1('product_' . $product->getId()));

      will flush all entries of the special product. Simular to cms-pages, cms-blocks and categories. Like @Tom said, a “Save” will run that code.

  4. Sorry and another question!

    In our store, as well as making use customer price groups, we also have specific customer price overrides in a bespoke table which is checked when customers view products for a match of customer id & sku.

    This is causing a problem. I have created a child block which calculates the customers price on the view.phtml and made it a dynamic block for fpc and thats fine.

    But the list.phtml is more of a challenge. Using a child element within the foreach $_product loop the child phtml doesnt have access to $this->getProduct(). So I’ve tried passing the ID to the child block like; $this->getChild(‘myblock’)->setAttribute(“prodId”,$_product->getId())->toHtml(), and then within myblock I am loading the product with the id. This works until I then make myblock a dynamic block in fpc config, because at that point the ->setAttribute.. is being set the same for every product.

    Is there a way to get fpc to not cache the ->setAttribute() command specifically, or failing that, could I add exceptions to the cache so I could say if the customer has specific price overrides then they should build a new version of cache for them specifically – not the best solution for performance, but it would work at least.

    Any ideas?

    1. Hello Tom,
      I’m sorry actually I didn’t see a way for your problem. But the next plan for me is to give Fpc more events, so that you could stop Fpc from caching in some special cases.

  5. Gordon, hi.

    what could be the reason of notice: Notice: Undefined offset: 1 in /home/httpd/buonanotte.ru/public_html/app/code/community/Lesti/Fpc/Helper/Data.php on line 136

    found it in logs.

    1. yes. we have this error too

      1 GB of data with the same error

      2014-09-10T11:59:30+00:00 ERR (3): Notice: Undefined offset: 1 in /home/user/domains/myshop.com/public_html/.modman/Lesti_Fpc/app/code/community/Lesti/Fpc/Helper/Data.php on line 155

      What could this be? Help appreciated!

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>