I'm actually trying to understand why memcached is not storing data for a given Id.
I'm using Magento EE 1.11.2.0 that is based on Zend Framework 1.11.1.
The interface used to deal with Memcached is Zend_Cache_Backend_Memcached
Now there is not such big custom code here, this is my custom container that save the cache:
public function saveCache($blockContent)
{
$lifeTime = 86400 * 30 * 6;
$tags = array(
My_Module_Model_PageCache_Container_Category_Blabla::CACHE_TAG
);
$cacheId = $this->_getCacheId();
if ($cacheId !== false) {
$this->_saveCache($blockContent, $cacheId, $tags, $lifeTime);
}
return $this;
}
I'm just forcing Magento to use my custom cache tag
and a fixed lifetime
( Memcached doesn't support custom tag so I guess this is not the problem ) also my lifetime
is not used in Memcached because I can see that the default one is used.
At the beginning I thought the issue was caused by a to long cache ID but now after reducing it ( <31 char ) this didn't help me:
I can see that the load()
method Zend_Cache_Backend_Memcached
return always false for my cache ids.
While the save()
method return true like if it was cached.
This is my local.xml configuration:
<cache>
<slow_backend_store_data>1</slow_backend_store_data>
<auto_refresh_fast_cache>0</auto_refresh_fast_cache>
<backend>memcached</backend>
<slow_backend>database</slow_backend>
<memcached>
<servers>
<!--<server>-->
<!--<host><![CDATA[127.0.0.1]]></host>-->
<!--<port><![CDATA[11213]]></port>-->
<!--<persistent><![CDATA[1]]></persistent>-->
<!--</server>-->
<server>
<host><![CDATA[unix:///tmp/memcached.sock]]></host>
<port><![CDATA[0]]></port>
<persistent><![CDATA[0]]></persistent>
<weight><![CDATA[2]]></weight>
<timeout><![CDATA[5]]></timeout>
</server>
</servers>
<compression><![CDATA[0]]></compression>
<hashed_directory_level><![CDATA[]]></hashed_directory_level>
<hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
<file_name_prefix><![CDATA[]]></file_name_prefix>
</memcached>
</cache>
<full_page_cache>
<backend>memcached</backend>
<slow_backend>database</slow_backend>
<slow_backend_store_data><![CDATA[1]]></slow_backend_store_data>
<memcached>
<servers>
<server>
<host><![CDATA[unix:///tmp/memcached.sock]]></host>
<port><![CDATA[0]]></port>
<persistent><![CDATA[0]]></persistent>
<weight><![CDATA[2]]></weight>
<timeout><![CDATA[10]]></timeout>
<retry_interval><![CDATA[10]]></retry_interval>
<status><![CDATA[1]]></status>
<stats_update_factor><![CDATA[1]]></stats_update_factor>
</server>
</servers>
</memcached>
</full_page_cache>
I also tried to check the entry of memcached to see if my id was stored or not with this command:
echo 'stats cachedump 35 35' | sudo nc -U /tmp/memcached.sock
- Any idea about the reason of this ?
- How can I debug it ? ( I cannot go under
Zend_Cache_Backend_Memcached
with xdebug)
There also a small things I don't understand:
- Even if I specify my
<cache_lifetime>
in my placeholder config that value is not used ? ( that is why I'm overriding thesave()
method )