1. Use of $uses and loadModel
Try not to use $uses in CakePHP 1.3.x version, because this will load all the used models, occupy memory and consume unnecessary time.
On the contrary, where you need to use the model, use loadModel to load it. If no associated data is required, set its recursive property to -1.
In addition, the default data model of the controller does not need to be loaded. If users_controller does not call loadModel(User), the User model and its associated models will be loaded automatically,
Just use it directly in the controller:
$this->User... ;
$this->User->Role...
Use lazy loading technology, version 1.3 has a lazy_model, replace the base class of your app_model with LazyModel,
will cause the model to be loaded only where it is actually called.
2. Use of eval and requestAction
Try not to use eval and requestAction. eval will cause a new script parsing process, and requestAction is equivalent to issuing a new request.
eval can be replaced with {} or $$ similar syntax, such as
case 1
$this->{$this->modelClass}->hasField("country_id");
-------------------------------------------------- ------------------
case 2
$foo = city;
$$foo = shanghai;
requestAction is replaced with view/helper
3. Cache
Use memcached where distributed data sharing is required, and try to use Apc for local data. Where Cache::write/read is used, specify which Cache configured in core.php is used through parameters.