CakeFest Virtual 2021 Day 2- Automatically Distributing Reference Queries in CakePHP - Yuki Kanazawa

Опубликовано: 19 Май 2026
на канале: CakePHP
215
6

In order to handle large amounts of accesses and large amounts of data, it is essential to have a mechanism to distribute reference queries to Replica.
CakePHP does not have distributing reference queries to Replica, but it can be done with a plugin.

cakephp-master-replica is a great plugin to do this.

This can be achieved by implementing a process to switch to Replica before executing a reference query, but if it is simply implemented, it will be cumbersome to write the switching process every time.

In this proposal, Yuki introduces the cakephp-master-replica plugin and shows an example implementation in CakePHP4 that automatically switches to Replica when a reference query is issued.