Support different types of cache

Full Page Cache will work correctly with Redis, Memcache, Apc, OPcache, File Cache, Database, Varnish automatically without any additional configuration.

We highly recommend to use REDIS as the best choice to work with FPC. REDIS keep all cache in RAM, so you can keep in RAM a large count of cache files without slow down your store.
REDIS allows to set a high values for the Cache Lifetime (for example: 604800 sec [7 days]) and store the cache for a long time. If you use other types of cache, high Cache Lifetime can significantly slow down the shop.

Varnish

Varnish has the same functions as FPC. If Varnish works correctly, then FPC will work correctly with Varnish too.

Configure magento to work with REDIS


~! REDIS must be installed on the server before configuring


1) Install Cm_Cache_Backend_Redis Magento Extension

  • Installation required if you are using Magento CE 1.7.0.2 and older, as Magento 1.8.0.0 it comes pre installed:

    • wget -O Cm_Cache_Backend_Redis.tar.gz https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/tarball/master
    • tar xzf Cm_Cache_Backend_Redis.tar.gz
    • cd colinmollenhour-Cm_Cache_Backend_Redis-*/
    • cp -r Cm /path/to/magento/app/code/local/
    • cp -r lib/Credis /path/to/magento/lib/
    cat > /path/to/magento/app/etc/modules/Cm_Cache.xml <<eof
    <?xml version="1.0" encoding="UTF-8"?>
    <config>
       <modules>
           <Cm_Cache>
               <active>true</active>
               <codePool>local</codePool>
           </Cm_Cache>
       </modules>
    </config>
    eof

2) Install Credis Library

  • Installation is not required if you are using Magento 1.8.0.0 or higher, as its already included in the base install:

    wget -O credis.tar.gz https://github.com/colinmollenhour/credis/tarball/master
    tar xzf credis.tar.gz
    cd colinmollenhour-credis-*/
    cp -r ./* /path/to/magento/lib/Credis/
    cd /path/to/magento/
    chown -R username. lib/Credis/
    chown -R username. app/code/local/Cm/
    chown -R username. app/etc/modules/Cm_Cache.xml

3) How to configure REDIS

  • To configure magento to work with REDIS, you need add the following lines to your configuration file (app/etc/local.xml) after </resources> tag:

    fpc_redis.png

    <cache>
        <backend>Cm_Cache_Backend_Redis</backend>
        <backend_options>
            <server>127.0.0.1</server>
            <port>6379</port>
            <database>0</database>
            <password></password>
            <force_standalone>0</force_standalone>
            <connect_retries>3</connect_retries>
            <automatic_cleaning_factor>0</automatic_cleaning_factor>
            <compress_data>1</compress_data>
            <compress_tags>1</compress_tags>
            <compress_threshold>20480</compress_threshold>
            <compression_lib>gzip</compression_lib>
            <persistent>1</persistent>
        </backend_options>
    </cache>

    ~! Please note that after installation sets default port number, but if its different, you should set correct port number of your hosting account.

Configure magento to work with MEMCACHE

~! MEMCACHE must be installed on the server before configuring You can check if you use MEMCACHE in phpinfo:

fpc_memcache_info.png

To configure magento to work with MEMCACHE you need to add the following lines to your configuration file ( app/etc/local.xml ) after </resources> tag:

  • MEMCACHE and file system

    <cache>
        <backend>memcached</backend>
        <memcache>
            <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_perm><![CDATA[]]></hashed_directory_perm>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcache>
    </cache>

    ~! Please note that after installation sets default port number, but if its different, you should set correct port number of your hosting account.

  • MEMCACHE and database

    <cache>
        <backend>memcached</backend>
        <slow_backend>database</slow_backend>
        <memcache>
            <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_perm><![CDATA[]]></hashed_directory_perm>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcache>
    </cache>

    ~! Please note that after installation sets default port number, but if its different, you should set correct port number of your hosting account.


Configure magento to work with MEMCACHED

~! MEMCACHED must be installed on the server before configuring.
You can check if you use MEMCACHED in Cache Storage Management page.

To configure magento to work with MEMCACHED you need to add the following lines to your configuration file ( app/etc/local.xml ) after </resources> tag:

  • MEMCACHED and file system

    <cache>
        <backend>memcached</backend>
        <memcached>
            <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_perm><![CDATA[]]></hashed_directory_perm>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    ~! Please note that after installation sets default port number, but if its different, you should set correct port number of your hosting account.

  • MEMCACHED and database

    <cache>
        <backend>memcached</backend>
        <slow_backend>database</slow_backend>
        <memcached>
            <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_perm><![CDATA[]]></hashed_directory_perm>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    ~! Please note that after installation sets default port number, but if its different, you should set correct port number of your hosting account.

Configure magento to work with database (instead of file system)

To configure magento to work with database (instead of file system) you need to add the following lines to your configuration file ( app/etc/local.xml ) after </resources> tag:

  • Database

        <cache>
            <backend>database</backend>
        </cache>

Full Page Cache