ZF-5938: Zend_Cache_Backend_Memcached failure_callback option


We should have an option to set failure call back function. I am trying to get failure count and report to admin if the memcache server is failing.

if (!array_key_exists('failure_callback', $server)) { $server['failure_callback'] = ''; } $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'], $server['weight'], $server['timeout'], $server['retry_interval'], $server['status'], $server['failure_callback']

for now I am extending the class and over ruled the constructor.


Hi, Imthiaz.

The failure_callback requires only string ?

I have afraid because the failure_callback may become varied types. http://jp.php.net/manual/en/…

I add the option to addServer. But , please tell me if the fix will break compatibility from ZF-5887


Thanks for the update, I used this file and it worked perfect.


Can we have one function to get the memcache object

public function getMemcacheObject(){ return $this->_memcache; }

This can be really usefull when to get stats from the connected servers.

$allServerFailed = true; $cacheServerStatus = $this->cacheAdapterClassInstance->getMemcacheObject ()->getExtendedStats (); if (! empty ( $cacheServerStatus )) { foreach ( $cacheServerStatus as $server => $status ) { if ($status !== false) { $allServerFailed = FALSE; } } }

Thanks for your update.

Hi, Imthiaz.

I feel happy because you feel good on this update. :-)

I will be also happy if you create new issue about getMemcacheObject() .

With Best Wishes.