您好,欢迎访问一九零五行业门户网

CakePHP: tips on ssl, mysql load balance, mas_PHP教程

1. cakephp master/slave
  *) add default(slave as for query) setting in database.php, and master for saving
  *) define a new replicate behavior
  usedbconfig = master;
         }
public function aftersave($model) {
          $model->usedbconfig = default;
         }
public function setserver($model, $server) {
          $model->__backupconfig = $model->usedbconfig;
          $model->usedbconfig = $server;
         }
public function afterfind($model) {
          if (!empty($model->__backupconfig)) {
           $this->usedbconfig = $model->__backupconfig;
          }
          $model->__backupconfig = null;
         }
public function save($data = null, $validate = true, $whitelist = array()) {
              $this->replication->beforesave($this);
              return parent::save($data, $validate, $whitelist);
         }
}
?>
    *) set $actas to have replicate behavior in your base app model
        $actas = array(replicate);
*) call the setserver method in your controller to determine which database you want to use for instant query after save
                if ($this->deal->saveall($this->data, array(validate=>first))) {
          $this->deal->setserver(master);
                    $deal = $this->deal->find(first,array(
                        conditions => array(slug => $this->data[deal][slug]),
                        fields => array(id)
                    ));
2. how to use xhprof (a php benchmark tool developed by facebook)
http://techportal.ibuildings.com/2009/12/01/profiling-with-xhprof/
3. mysql load-balancing
mysql-load-balancing-proxy-trafficscript>http://www.zeus.com/community/articles/building-mysql-load-balancing-proxy-trafficscript
4. ssl
consolidate secure operations to single domain: https://lang.secure.jigocity.com
keep track of referer links in http header
redirect back to the original referer when done
http://www.bkjia.com/phpjc/478813.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/478813.htmltecharticle1. cakephp master/slave *) add default(slave as for query) setting in database.php, and master for saving *) define a new replicate behavior ?php class replicationbehavior extends...
其它类似信息

推荐信息