This what I am using.
===
class AppModel extends Model {


        public function save($data = null, $validate = true, $fieldList =
array()) {

                $this->useDbConfig = 'master';

                $success = parent::save($data,$validate,$fieldList);

                $this->useDbConfig = 'default';

                return $success;

        }

        public function saveAll($data = null, $options = array()) {

                $this->useDbConfig = 'master';

                $status = parent::saveAll($data,$options);

                $this->useDbConfig = 'default';

                return $status;

        }

        public function updateAll($fields, $conditions = true) {

                $this->useDbConfig = 'master';

                $status = parent::updateAll($fields,$conditions);

                $this->useDbConfig = 'default';

                return $status;

        }

        public function delete($id = null, $cascade = true) {

                $this->useDbConfig = "master";

                $status = parent::delete($id,$cascade);

                $this->useDbConfig = 'default';

                return $status;

        }


}

====

For multiple Slaves you should use a load balancer to RoundRobin
Balance the requests to your slaves.


On Feb 10, 9:05 am, Okto Silaban <[email protected]> wrote:
> That's what I'm trying to do.
> I've setup 1 master and 2 slaves. But CakePHP doesn't support read & write
> query separation.
> So, do you have any information how can I split the read & write query?
> *other than rewrite all my models
>
> thanks.
>
> On Wed, Feb 9, 2011 at 10:03 AM, Dr. Tarique Sani 
> <[email protected]>wrote:
>
>
>
> > Have you split the reads and the writes?
>
> > All the writes go to the master which is on a server of its own and
> > the reads are from the slaves which are typically on the same machine
> > as the webserver and of course use very aggressive caching
>
> > Cheers
> > Tarique

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to