Thursday, April 22, 2010

Memcached troubles

Hello everyone,

I have a memcache which is set up like this in core.php:

Cache::config('default', array(
'engine' => 'Memcache',
'duration'=> 86400,
'probability'=> 100,
'prefix' => Inflector::slug(APP_DIR) . '_',
'servers' => array(
'web1.XXX.XXX 11211',
'web2.XXX.XXX 11211'
),
'compress' => false,
));

where web1 and web2 is the name of two webservers which balance the
load on the site by diverting some requests to either one.

It works fairly well (or so I thought) until I tried implementing a
maintenance mode for the site. I added this line:
Cache::write('maintenance', $this->data['admin']['maintenance']);

and then I check in beforeFilter() for

if (Cache::read('maintenance') == 1)
redirect('maintenance');

this works some of the time which leads me to believe that only one of
the servers are picking up on this value. Have I set it up somehow
wrong? Shouldn't both servers see 'maintenance' with the value set by
Cache::write?

Thank you,
Jonas

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate