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.

700 thoughts on “Lesti::Fpc”

  1. I would like to to know if its possible to use lesti and varnish together?

    (For cached pages)
    If I enable lesti FPC i get 300-500ms latency.
    If I run varnish only I get 25-56ms latency

    If I run varnish by itself, un cached pages have a latency of around 1.7-3 seconds

    If I run varnish and lesti FPC together the latency is around 500ms for all pages cached and un cached

    But what I think is happening here is Lesti is sitting in front of Varnish serving the cached pages before varnish can serve its cached page.

    What would be ideal is if Lesti could serve users pages that are not yet cached by varnish. Is this even possible?

  2. Hi Gordon,

    We’ve started using FPC and absolutely love it – also thanks for the quick fixes, I’ve seen many improvements lately. I also have a question and a suggestion:

    – setup: Magento 1.7 default cache settings for /var/cache (filesystem), and FPC 1.3.0 with APC backend for FPC
    – is it by design that cache entries are saved both in APC and under /var/cache/fpc-* too?
    – we had to add cart_header to lazy blocks (maybe it’s template specific, don’t know if it exists in default skins), please consider adding it as default if applicable

  3. I’m playing with your plugin on a new demo site – 1.9.something, with a nginx / hhvm / redis / percona stack. I’ve installed 1.3.1 but can see no means of managing it in the backend – I always used to see an entry on the system->cache page ( and it worked admirably! )

    Will this work / have I missed anything obvious?



    1. Hello Steve,
      I’m not sure if I understand you completely. You should see a Fpc entry in System => Cache Management and you should see the configs of the Fpc under System => Configuration => Advanced => System => Lesti FPC. Was that your question?

      Best Regards

      1. Hi Gordon,

        Yes, I’m playing with the magento demo site at with hhvm behind nginx, and don’t seem to be able to get your config stuff to appear. The only option I have is to use zend external cache.

        I’ve just upgraded to 1.3.2 ($ modman update-all
        Fetching changes for Cm_Cache_Backend_File
        Fetching changes for Cm_Cache_Backend_Redis
        Fetching changes for Lesti_Fpc
        Updating Cm_Cache_Backend_File
        Already up-to-date.

        Updating Cm_Cache_Backend_Redis
        Already up-to-date.

        Updating Lesti_Fpc
        Already up-to-date.


        symlinks are enabled,

        fpc.xml is configured to run against Redis, which is running, listening on /var/run/redis/fpc.sock, permissions 666.

        I’ve deleted the hhvm database to ensure it’s not holding anything out of date, and am generally a bit flummoxed…

        I expect it just doesn’t run with hiphop??

  4. Hi Gordon,
    i’m trying to disable caching to this block that shows the featured products using a custom slider:

    {{block type=”theme/product_list_featured” category_id=”1″ product_count=”4″ is_random=”1″ column_count=”4″ template=”catalog/product/list_featured_slider.phtml”}}

    I would like to disable caching in the slider because of the page shows always the same products in the list of featured products that are not randomized. I don’t find the correct syntax to use.
    Could you please give me some indications to solve this problem?

    1. Hello Andy,
      the answer isn’t that easy. Normally I would say, just give that block a nameInLayout and make it dynamic. But in your case, it tricky. I guess your featuredProducts-block needs the current product, but if Fpc loads the page from cache, there doesn’t exists a current product in magento. My solution is always (also without an Fpc), put the random part into Javascript. That’s also without Fpc, much much faster, cause you can use the block-cache and do not have to load always the featured-products from mysql.

  5. Hello,

    I have installed your perfekt extension, but i have a problem. I have on my shop a custom template and hide price extension.

    If the customers are logged on, they dont see the prices yet. First if i flush the cache, then they see the prices.

    Best Regards

  6. - Just installed, but disabled because top link only show up in one page checkout and button add to cart does not work well, it does not add the product to the top link cart and go directly to one page checkout.

  7. Hi Lesti,

    I’m testing fpc with new template. Everything is working except one strange thing.

    in the topheader i have shoppingcart as text and symbol. i have put the blockname [topcart] to the dynamic page. When i load the page the text and the symbol is missing. If i reload the page it’s there again. If i then refresh again the information stays visible. However if i change to a other article it is missing again the firsttime and after refresh it’s visible again. If i go back to the previous article the same happens again.

    I can’t figure out what is causing this! can you help?
    there is no information in the log file

      1. Hi Gordon,

        I have checked that, and it only exist in Dynamic. Switching from Dynamic to Lazy is giving the same result.

        I don’t have a clue why this is happening

        1. I guess I had this thing long ago, but I can’t remember the reason for this behavior. Can you try to log, what is in the variable $this->_placeholder, $this->_html and $body before str_replace at the end of Lesti_Fpc_Model_Observer::httpResponseSendBefore?

  8. Hello

    I have to ask this too; i installed it in my testshop without xcache and i saw under var/cache/fpc–0, fpc–1 and fpc–2

    But if i install it to my other shop with xcache, there is no fpc–0, 1 and 2….
    Is it normal? How can i test, if the cache works?

    Best Regards

      1. If you mean, that i use the cache for backend too, i m not sure. But i use now xcache and lesti fpc for frontend. If you mean, that i have a menu from xcache on the backend, no i haven’t.

        I have activated show age in the configs from lesti fpc, but how can i see the age of cache page? what you mean? what is http response header?

        Thank you

  9. hi Gordon

    I am using lesti FPC with redis as cache server. And memcache as first level cache/redis also as second level cache for magento two level cache. I usually get this error on my exception log, which always originates from


    This problem happens like once every hour, meaning front end renders a page which show user report instead of actual page. If user reloads the same page again, it works. So, it does not stop anything, but happening frequently makes bad user experience.

    I know this problem, might not be at all related to your module, but may be totally redis fault. But I wanted to confirm if you could help me resolve this issue. Please let me know what can i do to resolve this.

    Lost connection to Redis server.

    #0 /opt/lampp/htdocs/kartbin/lib/Credis/Client.php(499): Credis_Client->read_reply(‘expire’)
    #1 /opt/lampp/htdocs/kartbin/app/code/community/Cm/Cache/Backend/Redis.php(335): Credis_Client->__call(‘exec’, Array)
    #2 /opt/lampp/htdocs/kartbin/app/code/community/Cm/Cache/Backend/Redis.php(335): Credis_Client->exec()
    #3 /opt/lampp/htdocs/kartbin/lib/Zend/Cache/Core.php(390): Cm_Cache_Backend_Redis->save(‘a:2:{s:4:”body”…’, ’86a_3D66BCDF444…’, Array, 86400)
    #4 /opt/lampp/htdocs/kartbin/lib/Varien/Cache/Core.php(145): Zend_Cache_Core->save(‘a:2:{s:4:”body”…’, ‘3D66BCDF4442C4A…’, Array, 86400, 8)
    #5 /opt/lampp/htdocs/kartbin/app/code/community/Lesti/Fpc/Model/Fpc.php(67): Varien_Cache_Core->save(‘a:2:{s:4:”body”…’, ‘3D66BCDF4442C4A…’, Array, 86400)
    #6 /opt/lampp/htdocs/kartbin/app/code/community/Lesti/Fpc/Model/Observer.php(153): Lesti_Fpc_Model_Fpc->save(‘a:2:{s:4:”body”…’, ‘3d66bcdf4442c4a…’, Array)
    #7 /opt/lampp/htdocs/kartbin/app/code/core/Mage/Core/Model/App.php(1338): Lesti_Fpc_Model_Observer->httpResponseSendBefore(Object(Varien_Event_Observer))
    #8 /opt/lampp/htdocs/kartbin/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Lesti_Fpc_Model_Observer), ‘httpResponseSen…’, Object(Varien_Event_Observer))
    #9 /opt/lampp/htdocs/kartbin/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent(‘http_response_s…’, Array)
    #10 /opt/lampp/htdocs/kartbin/app/code/core/Mage/Core/Controller/Response/Http.php(82): Mage::dispatchEvent(‘http_response_s…’, Array)
    #11 /opt/lampp/htdocs/kartbin/app/code/core/Mage/Core/Controller/Varien/Front.php(184): Mage_Core_Controller_Response_Http->sendResponse()
    #12 /opt/lampp/htdocs/kartbin/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    #13 /opt/lampp/htdocs/kartbin/app/Mage.php(684): Mage_Core_Model_App->run(Array)
    #14 /opt/lampp/htdocs/kartbin/index.php(87): Mage::run(”, ‘store’)
    #15 {main}

  10. Hello, and thank you for quick reply, I double check and is not that.
    I forgot to mention I am using magento 1.9 and the theme is grayscale 2014 responsive, and the block in question is header_cart. I put that on lazy block’s but if I add a product it shows no product, except for the cart page. Everything else works jus fine.

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>