Thursday, October 29, 2009

CakePHP memcache Cache engine questions.

I'm having difficulty getting CakePHP to use more than one memcache
server.

I only have 1 memcached server, and i would like to read/write to
different ports, but it doesnt seem to be working well for me...

in my controller: I have the following code:


$ck = md5('user_auth'.$user_id);
if(!$salt = Cache::read($ck,'userauth')){
$salt = $this->find('first', array('fields'=>array
('id','salt'),'conditions'=>array('User.id'=>$user_id)));
if($salt){
Cache::write($ck,$salt,'userauth');
}
} else if ($salt) {
return $salt;
}

but it doesnt seem to be doing anything with the 'userauth' config i'm
specifiying.

If i do a Cache::settings('Memcache'); before the read/write, I'm
getting:Array ( [prefix] => app_ [duration] => 3600 [probability] =>
100 [engine] => Memcache [servers] => Array ( [0] =>
192.168.133.71:11213 ) [compress] => )
which is the 3rd memcache config specified. I've even tried to do a
Cache::set(Cache::settings('Memcache')); before the read/writes but no
luck.

Is this the way cakephp works with the memcache engine? any way to
tell the cache engine to use a different port atleast, or set it?

in my core.php, I have the following relevant sections:
Configure::write('Cache.disable', false);
Configure::write('Cache.check', false);

Cache::config('default', array('engine' => 'File'));
Cache::config('messages', array(
'engine' => 'Memcache', //[required]
'duration'=> 3600, //[optional]
'servers' => array('192.168.133.71:11214')
'compress' => false,
));

Cache::config('userauth', array(
'engine' => 'Memcache', //[required]
'duration'=> 3600, //[optional]
'servers' => array('192.168.133.71:11212'),
'compress' => false,
));
Cache::config('subscriptions', array(
'engine' => 'Memcache', //[required]
'duration'=> 3600, //[optional]
'servers' => array('192.168.133.71:11213'),
'compress' => false,
));

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: