user1578845
user1578845

Reputation: 41

magento full page cache with memcached

I am trying to get Magento's full page cache using memcached.

I understand that there is some configuration that needs to be set in the app/etc/enterprise.xml file, but there doesn't appear to be any documentation anywhere giving specific details of what this configuration should be.

From what I've read, it is similar to the memcached config in app/etc/local.xml but not quite the same.

Does anyone have this working who would be able to provide the appropriate configuration settings?

Upvotes: 4

Views: 6094

Answers (1)

Tim Hofman
Tim Hofman

Reputation: 1068

Full Page Cache can be enabled in your cache management page in the admin. To save the full page cache into memcache you need the following configuration. This XML can be found in app/etc/local.xml.additional and needs to be added to your normal local.xml.

Do mind that you want your FPC cache and sessions stored into a different memcached pool. Otherwise flushing the memcache will also result in logging out all of your customers. Flushing memcache can be done in the admin with the Flush Cache Storage.

Obviously this is only the Magento side, you also need to configure and run memcache on your server.

<config>
<global>
    <session_save><![CDATA[]]></session_save> <!-- db / memcache / empty=files -->
    <session_save_path><![CDATA[]]></session_save_path><!-- e.g. for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 -->
    <session_cache_limiter><![CDATA[]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values -->
    <cache>
        <backend></backend><!-- apc / memcached / xcache / empty=file -->
        <slow_backend></slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->
        <slow_backend_store_data></slow_backend_store_data> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether store data in db slow cache backend -->
        <auto_refresh_fast_cache></auto_refresh_fast_cache> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether refresh data in fast cache backend -->
        <memcached><!-- memcached cache backend related config -->
            <servers><!-- any number of server nodes can be included -->
                <server>
                    <host><![CDATA[]]></host>
                    <port><![CDATA[]]></port>
                    <persistent><![CDATA[]]></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_umask><![CDATA[]]></hashed_directory_umask>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    <!-- example of two level cache setup with slow backend at files. -->
    <full_page_cache>
        <backend_options>
             <cache_dir>full_page_cache</cache_dir>
         </backend_options>
         <slow_backend_options>
             <hashed_directory_level>1</hashed_directory_level>
             <hashed_directory_umask>0777</hashed_directory_umask>
             <file_name_prefix>fpc</file_name_prefix>
             <cache_dir><![CDATA[full_page_cache]]></cache_dir>
         </slow_backend_options>
     </full_page_cache>

    <remote_addr_headers><!-- list headers that contain real client IP if webserver is behind a reverse proxy -->
        <header1>HTTP_X_REAL_IP</header1>
        <header2>HTTP_X_FORWARDED_FOR</header2>
    </remote_addr_headers>
</global>

Upvotes: 3

Related Questions