企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
至于开启后有什么作用,我就懒得讲了,本文主要讲下微擎性能优化如何开启memcache与redis 温馨提示:不用纠结redis与memcache谁更好,这是多余的;你服务器安装了redis与memcache其中一个组件就可以开启。意思就是说开启了其中一个就好了。不要去纠结到底用哪个!!! ## 首先开启环境的redis扩展或者memcache扩展, 这里以Linux服务器安装宝塔控制面板做演示: 1.软件管理--找到你微擎所用的php版本--设置--安装扩展--找到memcache或者redis--进行安装(这两个安装一个就可以了),我这里顺带安装opcache(安装好后不需要额外配置) [![](https://www.99999699.cn/wp-content/uploads/2019/01/1-3.png)](https://www.99999699.cn/wp-content/uploads/2019/01/1-3.png)[![](https://www.99999699.cn/wp-content/uploads/2019/01/2-3.png)](https://www.99999699.cn/wp-content/uploads/2019/01/2-3.png)[![](https://www.99999699.cn/wp-content/uploads/2019/01/3-4.png)](https://www.99999699.cn/wp-content/uploads/2019/01/3-4.png) ## 微擎系统文件配置 然后编辑 /data/config.php 35行左右 查找如下代码 $config\['setting'\]\['cache'\] \= 'mysql'; 改成 $config\['setting'\]\['cache'\] \= 'memcache'; (你要开启memcache就写这个,开启redis就写redis) 然后在最下面增加 // --------------------------  CONFIG REDIS  --------------------------- // $config\['setting'\]\['memcache'\]\['server'\] = '127.0.0.1'; //memcache的配置 $config\['setting'\]\['memcache'\]\['port'\] = 11211; $config\['setting'\]\['memcache'\]\['pconnect'\] = 1; $config\['setting'\]\['memcache'\]\['timeout'\] = 30; $config\['setting'\]\['memcache'\]\['session'\] = 1; $config\['setting'\]\['memcache'\]\['sql'\] = 'memcache'; //开启缓存 或 // --------------------------  CONFIG REDIS  --------------------------- // $config\['setting'\]\['redis'\]\['server'\] \= '127.0.0.1';//如果redis服务器在别的机器,请填写机器的IP地址。 $config\['setting'\]\['redis'\]\['port'\] \= 6379; $config\['setting'\]\['redis'\]\['pconnect'\] \= 0; $config\['setting'\]\['redis'\]\['timeout'\] \= 1; $config\['setting'\]\['redis'\]\['requirepass'\] \= ''; 如下图开启的是redis [![](https://www.99999699.cn/wp-content/uploads/2019/01/12.png)](https://www.99999699.cn/wp-content/uploads/2019/01/12.png)[![](https://www.99999699.cn/wp-content/uploads/2019/01/122.png)](https://www.99999699.cn/wp-content/uploads/2019/01/122.png) 保存,刷新下微擎后台,即可查看到如图显示,已经开启成功。 [![](https://www.99999699.cn/wp-content/uploads/2019/01/0.png)](https://www.99999699.cn/wp-content/uploads/2019/01/0.png) 教程到此结束!