Hello.
Currently I'm using memcached 1.4.13.
Sometimes the ->remove() method doesn't work. It looks like that the value
stays there.
I can't say when it exactly doesn't work, but several hundreds times it
works as expected: the value will be cached, and can be removed without
problems - so the code looks really good at that place. But after several
hundreds of successfull times, it doesn't remove the value.
The question is: is/was this a known problem? Does anybody have some ideas?
I'm usind the Zend Framework.
Here is the important part of PHP code:
....
public static function getCache() {
if (!self::$cache) {
$options = array(
'servers' => array(
array(
'host' => Config::get('cache.memcached.host'),
'port' => Config::get('cache.memcached.port'),
'persistent' => true,
'weight' => 1,
'timeout' => 5,
'retry_interval' => 15,
'status' => true,
'default_lifetime' => 3600
),
),
);
self::$cache = Zend_Cache::factory('Core', 'Memcached',
array('caching' => true, 'automatic_serialization' => true,
'lifetime' => null),
$options);
}
return self::$cache;
}
....
....
public function getCountCached($user_id) {
$cache = System::getCache();
$cache_id = 'count_values__' . $user_id;
if ($cache->test($cache_id)) {
$data = $cache->load($cache_id);
} else {
$data = $this->countValues($user_id);
$cache->save($data, $cache_id, array(), Time::hours(2));
}
return (int)$data;
}
....
....
public function invalidateCountCache($user_id) {
$success = false;
for ($i = 0; $i < 5; $i++) {
if (!$success) {
$success = System::getCache()->remove('count_values__' .
$user_id);
} else {
return;
}
}
}
....
As I somewhere read before: ->remove() method also often returns FALSE,
also in case of removing was successful.
I hope somebody have some Idea.
With best regards,
Alex
--
---
You received this message because you are subscribed to the Google Groups
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.