В Magento (v.1.9.x) кеширането чрез Redis се активира с редакция в два файла на системата: /app/etc/modules/Cm_RedisSession.xml и /app/etc/local.xml.
Файловете можете да видите и редактирате чрез Файловия мениджър на контролния панел cPanel или през FTP (сваляте файла, редактирате и го качвате в акаунта).
Във файла: /app/etc/modules/Cm_RedisSession.xml
редактирайте кода от:
<Cm_RedisSession>
<active>false</active>
<codePool>community</codePool>
</Cm_RedisSession>
на:
<Cm_RedisSession>
<active>true</active>
<codePool>community</codePool>
</Cm_RedisSession>
Във файла: /app/etc/local.xml
е необходимо да се добавят следните редове,
след реда: <session_save><![CDATA[File]]></session_save> :
<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> <!-- 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 -->
<database>0</database> <!-- Redis database number; protection against accidental data loss is improved by not sharing databases -->
<password></password> <!-- Specify if your Redis server requires authentication -->
<force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP -->
<connect_retries>1</connect_retries> <!-- Reduces errors due to random connection failures; a value of 1 will not retry after the first failure -->
<read_timeout>10</read_timeout> <!-- Set read timeout duration; phpredis does not currently support setting read timeouts -->
<automatic_cleaning_factor>0</automatic_cleaning_factor> <!-- Disabled by default -->
<compress_data>1</compress_data> <!-- 0-9 for compression level, recommended: 0 or 1 -->
<compress_tags>1</compress_tags> <!-- 0-9 for compression level, recommended: 0 or 1 -->
<compress_threshold>20480</compress_threshold> <!-- Strings below this size will not be compressed -->
<compression_lib>gzip</compression_lib> <!-- Supports gzip, lzf, lz4 (as l4z) and snappy -->
<use_lua>0</use_lua> <!-- Set to 1 if Lua scripts should be used for some operations -->
</backend_options>
</cache>
След като запишете промените в този файл, Redis вече е активиран за системата Magento.
Настройките описани в тази статия са валидни за версия 1.9.3.1 на Magento.