一、确保服务器开启相应缓存组件,详见
二、修改微擎/data/config.php文件
大概在35行可以看到
$config['setting']['cache'] = 'mysql';
将其修改为
$config['setting']['cache'] = 'memcache';
在底部添加
// -------------------------- CONFIG MEMCACHE --------------------------- //$config['setting']['memcache']['server'] = 'localhost';$config['setting']['memcache']['port'] = 11211;$config['setting']['memcache']['pconnect'] = 1;$config['setting']['memcache']['timeout'] = 30;$config['setting']['memcache']['session'] = 1;
memcache或redis只能二选其一,如果要开启redis缓存,以上则改为
$config['setting']['cache'] = 'redis';
在底部添加
// -------------------------- CONFIG REDIS --------------------------- //$config['setting']['redis']['server'] = 'localhost';//如果redis服务器在别的机器,请填写机器的IP地址。$config['setting']['redis']['port'] = 6379;$config['setting']['redis']['pconnect'] = 0;$config['setting']['redis']['timeout'] = 1;$config['setting']['redis']['requirepass'] = '';
三、开启SQL缓存
前提是上面开启了memcache缓存,然后在config.php文件中插入以下这行代码即可。
$config['setting']['memcache']['sql'] = 'memcache';