• 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
What's Hot

机械模具加工公司网站设计案例

24 10 月, 2023

快速原型公司案例

24 10 月, 2023

陶瓷加工网站案例

24 10 月, 2023
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram
VPSEO VPSEO
  • 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
VPSEO VPSEO
Home»Magento»magento二次开发 – 在magento中配置使用redis缓存
Magento

magento二次开发 – 在magento中配置使用redis缓存

chrispengcnBy chrispengcn7 8 月, 2021没有评论2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

magento二次开发 – 在magento中配置使用redis缓存

php常用的缓存工具:memcached和redis,本文讲的是在magento框架中借助magento的模块来使用redis

  • 准备工作
  • magento中配置redis
  • 可能遇到的问题

准备工作

确保你的电脑安装并启动了redis服务、配置了php的redis扩展
若没有,查看此文《mac下安装配置redis》

magento配置reids

  1. 确保magento框架中安装并启用了Cm_Cache_Backend_Redis模块
  2. 修改以下路径中的local配置文件
    项目根目录/app/etc/local.xml
    在config/global下添加子节点cache如下
  1. <cache>
  2. <backend>Cm_Cache_Backend_Redis</backend>
  3. <backend_options>
  4. <server>127.0.0.1</server> <!-- or absolute path to unix socket -->
  5. <port>6379</port>
  6. <persistent></persistent> <!-- Specify unique string to enable persistent connections. E.g.: sess-db0; bugs with phpredis and php-fpm are known: https://github.com/nicolasff/phpredis/issues/70 -->
  7. <database>0</database> <!-- Redis database number; protection against accidental data loss is improved by not sharing databases -->
  8. <password></password> <!-- Specify if your Redis server requires authentication -->
  9. <force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP -->
  10. <connect_retries>1</connect_retries> <!-- Reduces errors due to random connection failures; a value of 1 will not retry after the first failure -->
  11. <read_timeout>10</read_timeout> <!-- Set read timeout duration; phpredis does not currently support setting read timeouts -->
  12. <automatic_cleaning_factor>0</automatic_cleaning_factor> <!-- Disabled by default -->
  13. <compress_data>1</compress_data> <!-- 0-9 for compression level, recommended: 0 or 1 -->
  14. <compress_tags>1</compress_tags> <!-- 0-9 for compression level, recommended: 0 or 1 -->
  15. <compress_threshold>20480</compress_threshold> <!-- Strings below this size will not be compressed -->
  16. <compression_lib>gzip</compression_lib> <!-- Supports gzip, lzf, lz4 (as l4z) and snappy -->
  17. <use_lua>0</use_lua> <!-- Set to 1 if Lua scripts should be used for some operations -->
  18. </backend_options>
  19. </cache>
  1. 清空magento缓存使得配置文件生效,关于如何清空magento缓存,参考《magento二次开发 – 如何清除magento缓存》

可能遇到的问题

6.22:
今天上午打开本地网站时报如下错误connection to Redis failed:

错误页面

发现是因为redis服务没有开启导致的,开启redis即可

说明magento在配置了redis之后那么要保持reids服务一直处于开启状态

参考:
[1]在magento中配置redis文档:

http://devdocs.magento.com/guides/m1x/ce18-ee113/using_redis.html

[2]Cm_Cache_Backend_Redis配置

https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/master/README.md

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
chrispengcn
  • Website

Related Posts

docker 环境下 安装Magento2(麦进斗)

26 12 月, 2021

magento 2.3 nginx 安装

7 8 月, 2021

Magento忘记密码怎么办

7 8 月, 2021

解决magento后台无法登陆/登陆没有反应的方法

7 8 月, 2021
Add A Comment

Leave A Reply Cancel Reply

*

code

导航
  • 首页
  • 关于我们
  • 服务项目
  • 项目案例
  • 博客文章
  • 联系我们
博客
  • 服务器运维
  • 服务器安装
  • nginx
  • PHP
  • WordPress
  • Python
  • Javascript
  • SEO
  • 电子商务
  • 大数据采集
  • 宝塔面板
  • 数据库
  • 电子商务
  • 虚拟化
  • 阿里云
导航
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们
最新文章
  • 机械模具加工公司网站设计案例
  • 快速原型公司案例
  • 陶瓷加工网站案例
  • CNC数控加工日文网站案例
  • 触摸一体机数字标牌厂家网站案例
关于我们
关于我们

广州纬来科技有限公司
联系地址:广东省广州市番禺区富华中路富源二街18号合和大厦809

QQ : 13602156
Email : 13926026058@139.com
Contact: +86 13926026058

Facebook Twitter YouTube LinkedIn
© 2025 广州纬来科技有限公司 粤ICP备2023105857号-2
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们

Type above and press Enter to search. Press Esc to cancel.