Lesti::Fpc

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.6.2.0, 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.

562 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:

    if($condition)
    {
    $this->getLayout()->getBlock('addon_index')->setTemplate('addon/a.phtml');
    }
    else
    {
    $this->getLayout()->getBlock('addon_index')->setTemplate('addon/b.phtml');
    }

    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
      Gordon

      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:
        mysite.com/brand-a/model-a/
        mysite.com/brand-a/model-b/
        mysite.com/brand-b/model-c/

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

        In the same way:

        mysite.com/brand-a/
        mysite.com/brand-b/

        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:

        $this->getLayout()->getBlock(‘module_index’)->setTemplate(‘module/brand.phtml’);

        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,
        Otto

        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
          Gordon

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>