使用 Redis 作为缓存后端
Redis 配置:
- 安装 redis(需要 2.4+)
- 安装 phpredis
- 安装 Magento 扩展
Cm_Cache_Backend_Redis
(仅适用于 Magento 1.7 及以下版本) - 编辑你的
app/etc/local.xml
:
<global>
...
<cache>
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>127.0.0.1</server> <!-- or absolute path to unix socket -->
<port>6379</port>
<persistent></persistent>
<database>0</database>
<password></password>
<force_standalone>0</force_standalone>
<connect_retries>1</connect_retries>
<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> <!-- Supports gzip, lzf and snappy -->
</backend_options>
</cache>
...
</global>