Search code examples
xmlmagentomemcached

Different ways to write memcached


I'm checking my server config while looking on internet for some tips and I have noticed that memcached is writtent in different ways.
I'm referring to this part of app/etc/local.xml:

<cache>
    <backend>memcached</backend>
...

In particular I have seen these ways:

  • memcache inside local.xml.additional and some tutorials
  • memcached on hosting sites and tutorials
  • Memcached inside one or two tutorial and stackoverflow answer

My question is: is there any differents? if yes which one is correct?


Solution

  • Are you referring to this, when saying "in local.xml.additionnal"?

    <config>
        <global>
            <session_save><![CDATA[]]></session_save> 
            <!-- db / memcache / empty=files -->
            <!-- ... -->
        </global>
    </config>
    

    Then you are mistakenly assuming <session_save> and <backend> under <cache> are the same, because later in this same file around line 38 you can read

    <config>
        <global>
            <!-- ... -->
            <cache>
                <backend></backend>
                <!-- apc / memcached / xcache / empty=file -->
            </cache>
            <!-- ... -->
        </global>
    </config>
    

    So, the answer is, when it comes to <backend> memcached is the right one, when it comes to <session_save> memcache is the right one.

    Furthermore, if you refer to Mage_Core_Model_Cache::_getBackendOptions() (in /app/code/core/Mage/Core/Model/Cache.php:154) you can find a big switch statement where memcached is one of the case and not memcache. Which prove the right value for cache > backend is with the final d.