I have a site that doesn't seem to be flushing memcached when the cache is flushed via the button "Flush Cache Storage". I have to manually log into the daemon by telnet and run flush_all to flush the cache
Am I misunderstanding something or is there some issue? I did check to make sure SELinux wasn't the culprit and it doesn't seem to be
Magento Enterprise 1.12.0.2 and my config is below.
<config>
<global>
<cache>
<backend>memcached</backend>
<memcached>
<servers>
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
</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>
<install>
<date><![CDATA[Tue, 05 Feb 2013 21:48:55 +0000]]></date>
</install>
<crypt>
<key><![CDATA[######################]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[magento]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[development]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
</config>
Best Answer
How do you know the cache isn't being cleared? I had a similar problem today, but I was relying on the "curr_items" count in Memcached to test it, which isn't an accurate test.
I set up a Magento shell, which called:
This is the method that the "Flush Cache Storage" button calls in the Magento admin. I wanted to check that Memcached was really getting cleared.
I connected to Memcached using telnet, and monitored the "curr_items" count before and after clearing the cache. It barely changed (usually just dropped by one item).
Then I found this: http://www.couchbase.com/issues/browse/MB-2258
It says that the "curr_items" count doesn't drop, even when a (brutal)
flush_all
is executed directly on the Memcached server. The count only drops the next time someone tries to access a key which no longer exists.True enough, that's what happened. My cache was being cleared as desired, but only when I refreshed a few pages for the first time, did the count drop (and then rise again, on subsequent requests).
I observed the same results when I ran
flush_all
from the telnet connection. The count remained unchanged, until I tried to access one of the former keys, at which point the count dropped by one.