1

How do set REDIS with APC in magento (local.xml)?

I have to put twice the "< backend >"?

My code looks like this:

<cache>
   <backend>apc</backend>
    <slow_backend>file</slow_backend>
    <slow_backend_store_data>0</slow_backend_store_data>
    <auto_refresh_fast_cache>1</auto_refresh_fast_cache>
    <lifetime>259200</lifetime>
    <prefix>database_</prefix>

  <backend>Cm_Cache_Backend_Redis</backend>
  <backend_options>
    <server>127.0.0.1</server>
    <port>6379</port>
    <persistent></persistent>
    <database>0</database>
    <password></password>
    <force_standalone>0</force_standalone>
    <connect_retries>1</connect_retries>
    <read_timeout>10</read_timeout>
    <automatic_cleaning_factor>0</automatic_cleaning_factor>
    <compress_data>1</compress_data>
    <compress_tags>1</compress_tags>
    <compress_threshold>20480</compress_threshold>
    <compression_lib>lzf</compression_lib>
  </backend_options>
</cache>
| improve this question | | | | |
  • donot use APC, install ZendOpcache, and keep it only for php, and use Redis only for cache. – user2857 Jun 5 '15 at 7:32
0

You cant set both as cache backend. But you could chose one as normal backend, and one as slow backend where you currently have file.

I think redis was suited as slow one, but iam not sure about this.

| improve this answer | | | | |
0

APC is great for OPCode, terrible for data key pair storage. APC should be working as-is with no need to add it to local.xml for handling the cache of PHP's OPcode.

Only one backend handler is allowed, while slow/fast backend types would fall under this branch in the xml tree.

<config>
<global>
    <session_save><![CDATA[]]></session_save> <!-- db / memcache / empty=files -->
    <session_save_path><![CDATA[]]></session_save_path><!-- e.g. for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 -->
    <session_cache_limiter><![CDATA[]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values -->
    <cache>
        <backend></backend><!-- apc / memcached / xcache / empty=file -->
        <slow_backend></slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->
        <slow_backend_store_data></slow_backend_store_data> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether store data in db slow cache backend -->
        <auto_refresh_fast_cache></auto_refresh_fast_cache> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether refresh data in fast cache backend -->
        <memcached><!-- memcached cache backend related config -->
            <servers><!-- any number of server nodes can be included -->
                <server>
                    <host><![CDATA[]]></host>
                    <port><![CDATA[]]></port>
                    <persistent><![CDATA[]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    <!-- example of two level cache setup with slow backend at files. -->
    <full_page_cache>
        <backend_options>
             <cache_dir>full_page_cache</cache_dir>
         </backend_options>
         <slow_backend_options>
             <hashed_directory_level>1</hashed_directory_level>
             <hashed_directory_umask>0777</hashed_directory_umask>
             <file_name_prefix>fpc</file_name_prefix>
             <cache_dir><![CDATA[full_page_cache]]></cache_dir>
         </slow_backend_options>
     </full_page_cache>

    <remote_addr_headers><!-- list headers that contain real client IP if webserver is behind a reverse proxy -->
        <header1>HTTP_X_REAL_IP</header1>
        <header2>HTTP_X_FORWARDED_FOR</header2>
    </remote_addr_headers>
</global>

A good example local.xml from:

Further reading:

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.