User Tools

Site Tools


Sidebar

magento_1:full_page_cache

For more details see the Full Page Cache extension page.

Full Page Cache

Speed up your Magento using cache to the full. Decrease pages time load and improve user experience, which leads to a better conversion rate and higher search rankings.

  • Magento loads pages much-much faster
  • Huge decrease of your server load
  • Better search engine indexing and higher rankings
  • Dynamic blocks / “hole punch” support
  • Includes cache crawler!

When you don’t have FPC extension installed, each time a visitor comes to any page of your website, Magento first reads a bunch of configuration files to check which blocks need to be displayed on the page. After that Magento takes each block and starts “generating” it and placing on the page. This all takes much time.

General Settings

To get access to the 'Full Page Cache' settings go to: System → Configuration → Full Page Page

Page Cache Lifetime - the option displays a period of time the page cache is valid. When the indicated time period is over the cache will get the status 'invalid'. A first one who visits a page will get the status 'Cache Miss' (all next visitors get 'Cache Hit'). The value '0' sets unlimited time period (recommended for stores with no changes - static content).

Enable Dynamic Blocks - the option enables or disables dynamic blocks on the front end:

Yes - option allows to refresh certain blocks on the front end, e.g when a product is added to a shopping cart and than go to a category page the only content which will be refreshed is: 'mini_cart' block (the block name may differ based on a custom theme), the page status is 'Cache Hit'.

No - option disables block refreshing on the front end, e.g when a product is added to a shopping cart, the cache stops work and all the pages get the status 'Cache Miss'.

Block Cache Lifetime - the option is available only if 'Enable Dynamic Blocks' = 'Yes' and indicates the period of time block cache is valid.


Pages

Cache All Pages - determines the 'FPC' behavior.

'No' (default value) - only the following pages will be cached: product, category, CMS. The pages like: checkout, shopping cart page, customer account page, wishlist, product comparison and also URLs related to 3rd party module(s) are not cached.

Yes - all URLs associated with a web shop will be cached. When this option is enabled please make sure that all pages with private information are added to 'Ignore List' (text area below) to avoid caching private information, e.g. redirect to payment gateways, pages with payment forms, customer account information, etc. Also the option allows to cache pages from 3rd party extensions. For example page like: example.com/custom-url/ will be cached.

It is extremely important to keep shopping cart page, customer account and all checkout pages uncached for correct operation of checkout process.

Ignore list - these URLs are out of cache and never be cached till they are in the list.

How to use special symbols:

^ - it indicates a part of the URL right after the domain name.
For example the following line is added to the ignore list ^url1 and the URL is: example.com/url1/url2/ - it will be ignored by the cache as it matches the ignore list condition.
But the url: example.com/url2/ulr1 - will be cached as the ulr1 part doesn't follow the domain name

/urlkey/ - any URL where the /urlkey/ is a part of a full path will be ignored, e.g. : example.com/url1/urlkey/url2/url3

urlkey - any URL with the part urlkey in the URL will be excluded from the cache for example, e.g. : example.com.com/url1/urlkeyurl2/url3

GET Params To Bypass Cache - Pages containing specified GET params in their URLs will not be cached.

GET Params To Ignore - Pages containing specified parameters in URLs will be cached like the same pages without these parameters in their URLs. This will help to avoid content duplication.


Product

Flush Type - the option allows to set how the cache behaves itself when product information is updated (for example changes are made via the Magento admin panel: Catalog → Manage Product → Edit a product → Save or Save and Continue).

Flush Only Product Page - a specific product page cache will be flushed. First visit = 'Cache Miss', e.g. a product A is modified from the admin area and change are saved. The cache for product A page is flushed.

Also Flush associated pages - the cache of a specific product and all associated category pages will be flushed. For example the product is assigned to: Category → Subcategory - after some changes in admin area both 'Category' and 'Subcategory' cache will be flushed.

Flush Product Page Cache After Each Purchase - if set to 'Yes' keeps visible stock status information on the product and category pages up-to-date. In case module like 'Custom Stock Status' → https://amasty.com/custom-stock-status.html is installed.


Category

Flush Entire Page Cache After Each Category Update - if the option is set to 'Yes' the cache will be flushed each time when a category is edited and saved at: Catalog → Category Management → Save Category


Mobile Design

Enabled - the option either enables or disables separate design for mobile devices and PC.

User Agents - available only when the option 'Enabled' has value 'Yes'. Includes all agents which will get a mobile version on page load. The agents listed in the field should be the same as agents listed at: System → Configuration → Design → Themes (if a custom theme is set via Magento native functionality)


Cache Storage Settings

Enable GZIP - the option enables cache compression and allows to save some space. It takes a chunk of data and makes it smaller also may increase CPU load.

Compression Level - The level of gzip compression simply determines how compressed the data is on a scale from 1-9, where 9 is the most compressed. The trade-off is that the most compressed data usually requires the most work to compress/decompress, so if you have it set fairly high on a high-volume website, you may feel its effect.

Maximum Storage Size - In Megabytes. If the limit is reached a new cache won't be saved (no new records in a database).


Search Engines

Don't Start Session for Search Engines - don't start the session for agents listed below however the agents still see cached results.

User Agents - the list of agents do not start the session to.


Statistics

Collect Page Visit Statistics - if the 'Amasty FPC module built-in table' is set as the 'Query Generation Source' it should be set to 'Yes'. The option saves customer's visit history and pass it to the cache crawler.


Cache Regeneration

Reset Page Lifetime When It Visited By Customer - the option reset the page lifetime each time it is visited. For example the life time = 72 hours and 22 hours have been passed so the current life time = 50 hours. If a customer visits a page it will reset the life time back to 72 hours again.

Crawler Action:

None - nothing happens with the page when a crawler visits it.

Regenerate cache lifetime - similar behavior to 'Reset Page Lifetime When It Visited By Customer option'

Re-crawl page - the action updates cache record in the database.


General Improvements

Automatically clear session and reports - automatically deletes files under var/session/ and var/report/ folders to minimize disk load. The time period depends from: Delete session and report files older than, days


Developer Settings

Enable Debug Hints - allows to show the debug hints on the front end. The hints are available only when the page cache status = 'Cache Hit'

The hints on the front end:

Show Time Stats - when set to 'Yes' shows the current page generation time and page status

The time stats on the front end:

Hidden Stats in HTML Comment - adds <!– AMFPC|Cache Hit|0.025s –> to the end of the page HTML source. Where 0.025 is a current page generation time.

Display All Block Names - allows to see all block names on the front end. The block names will be shown on the page where the status is equal to 'Cache Miss' or 'Contains ignored params'. If you have a page and want to show the hint but don't flush the cache just add the following parameter to the URL: ?amfpc_nocache

Block names on the front end:

Display Block Template Path - adds full template path to block name which allows to find a correct template.

Show Debug Information Only For - comma separated list of the Ips which will see all the debug info.

Enable Debug Mode Via GET Params - usually are used when a server cannot correctly detect IP. Enable debug information for current session:

http://example.net/page.html?amfpc_debug_enable

Disable debug information for current session:

http://example.net/page.html?amfpc_debug_disable

Show debug information for current page only:

http://example.net/page.html?amfpc_debug

Full Page Cache Crawler

To get access to 'Full Page Cache Crawler' settings go to: System → Configuration → Full Page Page Crawler

All queue operations including its generation and processing have built-in protection from simultaneous activation. It means that if a task is not finished yet and it was called by cron again, the operation won’t be activated again before the first task is finished. This algorithm is implemented through blocking a specific file in the /var/tmp folder using a FLOCK() PHP function. Thus, this feature may not work on Windows Servers.


General Settings

Enable crawler - enables or disables the cache crawler. The option has a 'Global' scope so it is not possible to run the crawler on a certain web store/store view.


Page combinations

Please be aware that each link from the queue is to be checked with all settings combinations from the General Settings tab and with default settings (when there is no directions for the link).

Example:

You’ve chosen the following settings:

«Customer Groups» = General

«Stores» = English, French

«Currency» = USD

«Process mobile view» = no

You have four settings chosen: one for a customer group, two for stores, one for currency, Process mobile view

isn’t chosen. Besides, each of these

settings will not be specified for the request (e.g. set as Default).

Thus, here’s the number of combinations for three links:

2 links * 2 customer groups * 3 stores * 2 currencies = 24 request variants

As a result, each link will be checked in the following 12 combinations:

1. Default + Default + Default : the page is requested with no parameters whatsoever.

2. General + English + USD : switched to General group + English is on + currency changed to USD

3. General + English + Default : switched to General group + English is on + no currency is set

4. General + French + USD : switched to General group + French is on + currency changed to USD

5. General + French +Default : switched to General group + French is on + no currency is set

6. General + Default + USD : switched to General group + English is on + currency changed to USD

7. General + Default + Default : switched to General group + English is on + no currency is set

8. Default + English + USD : no group is set + English is on + currency changed to USD

9. Default + English + Default : no group is set + English is on + no currency is set

10. Etc.


Crawler Options

Accepted URL Status - the list of page statuses which will be accepted by the crawler. You may check the page status following way:

If the page status is differ from entered in the list it won't be accepted by the crawler.


Queue Options

Queue Max Size - allows to set the maximum queue size.

Queue Process Limit - the number of rows which will be processed by one cron run (recommended value is: 50)

Query Generation Source - allows to select any of 4 available generation sources.

Amasty FPC module built-in table - default option. If the option is chosen the crawler will take information about URLs to add to queue from the database table: amasty_amfpc_url

Magento built-in log table - this option makes crawler use the follow table: log_url_info

Text file with one link per line - some custom text file with a list of links to be crawled (one link per line).

Sitemap XML - the option requires valid xml sitemap located in Magento root folder.


Logging Options

Log Max Size - Maximal number of rows in the log table.


Force cron job actions

Generate queue - allows manually generate the queue. The crawler will take URLs to create a queue from Reports → Full Page Cache → Pages to index

The queue is stored in the am_fpccrawler_queue table and contains a link and a rating value. Only links not less than 5 characters long are added to the queue. The queue is populated with links and cleaned down to the size specified in the settings after each 500 links added, and also every time when queue generation begins.

Process queue - allows manually process the queue.

Queue processing is done link by link and, after all parameter combinations are done, the link is deleted from the queue. All requests are performed using CURL PHP library. If you don’t have it installed on your server, you’ll have a warning message in the extension settings. The queue has five nested loops for passing through enumeration of all possible parameter combinations: Customer Group, Store, Currency, Language, Mobile.

Plus, there’s an option when each parameter may be not set and won’t be added to the request, in other words, a default setting is used to load the page.

Currency and group switch is performed with getting a specific cookie for this combination of currency and customer group, which is then attached to the HTTP request header. Every time the tool checks if there is such a cookie, and if there is no cookie or it’s expired, another one is received, otherwise the available one is used.

Logging in as an account from one of the customer groups is also performed with a specific cookie. To get the authorization data a specific user is created. Its name will be FPC.Crawler.ххх, where xxx is the customer group number (ID). This user is designed for extension’s internal use and will be created each time during queue processing, if there isn’t any or if it was previously deleted.


Advanced

Show warnings and notifications - Enables output of notifications and warnings about cron task execution time.

Debug mode - Enables output of debug info into the logs.


Visual Stats

Status Codes

Status Code - The statistic shows page status and the quantity of each statuses for all pages returned after the link request are shown. Very informative for showing percentage of errors and success loads.


Pages Crawled

Pages Crawled - Summary stats of requested pages for the previous time period by day.


Page Load Time

Page Load Time - the list of top 20 of the slowest pages.


Queue Processing

Queue Processing - shows all necessary information about current queue. A detailed description of time needed to process the whole queue.


Log

The log shows all the URLs which were crawled. The log contains all possible variants based on selected 'Pages Combinations' This is a table with vivid display of values from the logs table. You can make use of handy search by any parameter.


Queue

The list of all links which wait for be crawled. This is a table with vivid display of values from the current queue table.


Pages to Index

The list of all URLs visited at the web shop. The pages with the highest rank (the most popular) will be submit to cache crawler queue next time.


Tweaking

How to hole punch cart/welcome blocks

1. Go to System → Configuration → Full Page Cache → enable 'Developer Settings' like on the following screenshot →

2. Now you will see the following result on the front end:

If there are no block names add the parameter to URL to get not cached page and reload the page: ?amfpc_nocache

3. Now find a necessary block name e.g. :

4. Go to: app/etc and open the file » amfpc.xml

5. Open the file and find <blocks>…</blocks> section

6. Add new block e.g:

<custom.block.name cart="1" /> //to hole punch cart block, customer="1" - login block

The screenshot for details:

Where 'custom.block.name' block name on the front end.


How to hole punch blocks via Ajax

1. Go to System → Configuration → Full Page Cache → enable 'Developer Settings' like on the following screenshot →

2. Now you will see the following result on the front end:

If there are no block names add the parameter to URL to get not cached page and reload the page: ?amfpc_nocache

3. Now find a necessary block name e.g. :

4. Go to: app/etc and find the file » amfpc.xml

5. Open the file and find the following section:

<ajax_blocks>
                <messages />
                <global_messages />
                <right.reports.product.viewed />
                <left.reports.product.viewed />
 
                <optimiseweb_cookienotice />
 
                <multipledeals_recent />
                <multipledeals_list />
                <multipledeals />
                <multipledeals_sidedeals />
                <multipledeals_cms />
</ajax_blocks>

6. Add new block e.g:

<newly.added.products />

The screenshot for details:

Where 'newly.added.products' block name on the front end


Hole punching CMS blocks (blocks added via the xml)

1. The original block code line looks (example):

{{block type="reports/recently_viewed" template="reports/recently_viewed.phtml"}}

To hole punch it from cache it should have a unique name (example)

{{block type="reports/recently_viewed" template="reports/recently_viewed.phtml" 
nameInLayout="blockname" }}

Where 'blockname' is a value of 'nameinlayout' you may set any name and but it should be unique (required option)

2. Open app/etc/amfpc.xml and find <ajax_blocks>…</ajax_blocks> section

3. And add <blockname />

Where <blockname /> should be equal to blockname from the block content.

In the same file find the line:

<cms_blocks>0</cms_blocks>

Replace 0 with 1 and it should look:

<cms_blocks>1</cms_blocks>

How to check cache crawler

To check how the 'FPC Cralwer' works, please follow these steps (manual way):

1. Set the 'Amasty FPC module built-in table' as 'Query Generation Source' at: System → Configuration → Full Page Cache Crawler »

2. Make sure that the following setting is enabled: System → Configuration → Full Page Cache → Statistics

2. Go to home page

3. Visit some category and product pages (required option)

5. Go to admin panel: System → Configuration → Full Page Cache Crawler → Force cron job actions → Click to 'Generate queue'

6. Check new records at: Reports → Full Page Cache Crawler → Queue

7. Go to admin panel: System → Configuration → Full Page Cache Crawler → Force cron job actions → Click to 'Process queue'

8. Check new records at: Reports → Full Page Cache Crawler → Log


How to flush home page cache + FPC

Create a php file with the content above and run it in a browser

<?php
    require_once 'app/Mage.php';
    Mage::app();
    Mage::getSingleton('amfpc/fpc')->clean('amfpc_index_page');

How to flush certain pages

<?php
    require_once 'app/Mage.php';
    Mage::app();
    Mage::app()->cleanCache('CATALOG_PRODUCT_12345');
    Mage::app()->cleanCache('CATALOG_CATEGORY_12345');

replace 12345 with product and category IDs


Flush cache + FPC

Create a php file with the content above and run it in a browser

 <?php
    require_once 'app/Mage.php';
 
    //Flush Magento cache
    Mage::app()->getCacheInstance()->flush();
 
    //Flush Amasty FPC
    if (Mage::helper('core')->isModuleEnabled('Amasty_Fpc')) {
    Mage::getSingleton('amfpc/fpc')->flush();
    }

FPC + Redis

Download pre-configured file by clicking to the link

Edit the file with Redis data.

Upload the file to: app/etc

Check the result (the database table core_cache shouldn't be increased)


Cookies issue

If there is the issue with a cookies block:

1. System → Configuration → Full Page Cache → Developer Settings → Display All Block Names → Set to Yes

2. Check the front end for the cookie block name:

3. Open the file: app/etc/amfpc.xml

4. Find the line:

<cookie_notice_block>global_cookie_notice</cookie_notice_block>

and replace global_cookie_notice with your cookie block name

5. Flush all the cache and check the result


How to disable FPC at a certain store (multi store setup)

1. Open the file: app/code/local/Amasty/Fpc/Model/Observer.php

 protected function _canPreserve()
{
    if (Mage::app()->getStore()->getId() == 123)
        return;

replace 123 with store ID


How to exclude Home page from the cache

Check the option: System → Configuration → Full Page Cache → Pages → Cache All Pages

If the option 'Cache All Pages' is set to 'Yes' please add the following line to the 'Ignore List' ^/$

If the option set to 'No', please open the following file: app/etc/ampfc.xml

and comment these lines:

<index>
<path>cms/index/index</path>
<tags>cms_page,amfpc_index_page</tags>
</index>

How to clear cache for specific pages individually

It may be necessary to clear cache on each specific page individually.

Programmatically. With the extension, you can clear cache for specific page, using the code. You should use the code for specific page (e.g. “eyewear.html”) the following way:

Mage::getSingleton('amfpc/fpc')->clearByUrl('http://example.net/default/accessories/eyewear.html'); 

GET Param. Use the following request with GET Parameters.

"?amfpc_refresh"
To activate the option for a specific product, employ product grid update attributes mass action.

Internal errors logging

Each time there’s an error due to the script’s performance it is logged into internal files in the logs folder. These files are beginning with amfpccrawler_хххх and can be distinguished by the name of the script part which the error refers to. For instance, their names can be: amfpccrawler_auth_cookie.log and amfpccrawler_queue_add.log.


Requests logging

Each request is logged into am_fpccrawler_log internal table, which stores all the request parameters, the link rating, the reply (status) code, and page load speed. You can use Log Max Size setting to specify the max number of records for logs.

Rate the user guide
 stars  from 17 votes (Details)
magento_1/full_page_cache.txt · Last modified: 2017/05/17 16:27 by prakapovich