使用Full Page Cache插件Lesti_Fpc加速magento

agento Full Page Cache插件很多,这里介绍Lesti_Fpc这个免费全页缓存插件。

插件安装

插件下载:https://github.com/GordonLesti/Lesti_Fpc 安装完成后到Cache Management你们可以看到Fpc 这栏。 然后开启它

使用设置

Lesti_Fpc 的后台配置在:ADVANCED > System > Lesti FPC 这里主要说下Lesti_Fpc处理一些动态内容block的问题,例如显示购物车数量的block,这个是不能缓存的。 动态内容的block只需要把布局配置文件layout里面的block name 填入设置的Lazy Blocks中即可。

那几个block是magento自带的模板里面的动态内容block。 例如里面的 minicart_head 这个是 rwd模板 右上角 显示 购物车内容的 block 其名称来自文件:/app/design/frontend/rwd/default/layout/checkout.xml

<reference name="header">
            <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
                <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
                ...

看了上面的代码,应该是很容易理解了。需要用这个Full Page Cache插件的话就这样根据你的模板来配置。

缓存配置

参考app/etc/fpc.xml.sample 的文件,可以把配置直接放入local.xml文件的节点

Redis

<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
   <server>127.0.0.1</server>
   <port>6379</port>
   <persistent>cache-fpc</persistent>
   <database>1</database>
   <password></password>
   <force_standalone>1</force_standalone>
   <connect_retries>1</connect_retries>
   <lifetimelimit>86400</lifetimelimit>
   <read_timeout>10</read_timeout>
   <compress_data>1</compress_data>
   <compress_tags>1</compress_tags>
   <compress_data>gzip</compress_data>
</backend_options>

注意设置persistent 的值 ,避免同一个 redis database安装了多个magento造成的冲突

apc

<backend>apc</backend>
<prefix>LESTI_FPC_</prefix-->

memcached

<backend>memcached</backend>
     <memcached>
          <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                </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>

未经允许不得转载:哈勃私语 » 使用Full Page Cache插件Lesti_Fpc加速magento

本文共1763个字 创建时间:2018年11月3日17:40   

分享到:更多 ()