Magento1.9X 开启Redis缓存

1、安装Redis,我是在宝塔下运行的直接去软件商店里面安装即可;非宝塔用户命令行解决;安装完成去宝塔安全管理里面放行6379端口;非宝塔用户自行命令行开启端口;

2、下载并安装启用了Cm_Cache_Backend_Redis模块,注意:

  1. 这个安装包是自动安装的,如果你不是用modman安装而是手动装需要注意路径问题,1.9x下的app\code\community\Cm;
  2. 扩展包里面有个lib文件夹下载下来是个空的,你要在github上点进去会跳到这个lib的官方,再下载这个lib;放到你的lib下面;

3、编辑app/etc/local.xml,在config/global下添加子节点 内容如下:

        <cache>
          <backend>Cm_Cache_Backend_Redis</backend>
          <backend_options>
            <server>127.0.0.1</server>
            <port>6379</port>
            <persistent></persistent> 
            <database>0</database> 
            <password></password> 
            <force_standalone>0</force_standalone> 
            <connect_retries>1</connect_retries>   
            <read_timeout>10</read_timeout>    
            <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>
            <use_lua>0</use_lua>
          </backend_options>
        </cache>
        <full_page_cache>
          <backend>Cm_Cache_Backend_Redis</backend>
          <backend_options>
            <server>127.0.0.1</server>
            <port>6379</port>
            <persistent></persistent>
            <database>1</database>
            <password></password>
            <force_standalone>0</force_standalone>
            <connect_retries>1</connect_retries>
            <lifetimelimit>57600</lifetimelimit>
            <compress_data>0</compress_data>
            <auto_expire_lifetime></auto_expire_lifetime>
            <auto_expire_refresh_on_load></auto_expire_refresh_on_load>
          </backend_options>
        </full_page_cache> 

4、清空magento缓存,rm -rf yoursitepath/var/cahe *,随便访问几个页面

5、登录SSH,执行命令:redis-cli 执行命令:select 0执行命令:keys *会出一堆数据则证明配置成功;

最后,至于网上说的开启系统自带的RedisSession个人表示比较懵逼;开启后后台就登录不了了,具体原因好像是不能替换lib/Client.php这个文件;

开启RedisSession方法如下,不保证你不会出问题!

1、编辑app/etc/local.xml,在config/global下添加子节点 内容如下:

        <session_save>db</session_save>
        <redis_session>                      
            <host>127.0.0.1</host>            
            <port>6379</port>
            <password></password>             
            <timeout>2.5</timeout>            
            <persistent></persistent>         
            <db>0</db>                       
            <compression_threshold>2048</compression_threshold> 
            <compression_lib>gzip</compression_lib>              
            <log_level>1</log_level>              
            <max_concurrency>6</max_concurrency>               
            <break_after_frontend>5</break_after_frontend>      
            <fail_after>10</fail_after>                          
            <break_after_adminhtml>30</break_after_adminhtml>
            <first_lifetime>600</first_lifetime>                 
            <bot_first_lifetime>60</bot_first_lifetime>        
            <bot_lifetime>7200</bot_lifetime>            
            <disable_locking>0</disable_locking>          
            <min_lifetime>60</min_lifetime>    
            <max_lifetime>2592000</max_lifetime>      
        </redis_session>

注释掉原来的<session_save><![CDATA[files]]></session_save>

2、编辑app\etc\modules\Cm_RedisSession.xml 开启模块 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值