mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-17 06:59:51 +00:00
![]() Before this commit you have to do some hacks to cache model finds easily. When using custom find methods like `find('foo')` => `_findFoo(...)` it is common for the method to adjust the query params. Trying to cache a query using a hash of the query params : function find($type, $query) { $query = $this->_beforeFind($query); $cacheKey = $type . '_' . md5(selialize($query)); $cache = Cache::read($cachKey, 'my_cache'); if ($cacheKey !== false) { return $cache; } $results = $this->_afterFind($type, $query); Cache::write($cacheKey, $results, 'my_cache'); return $results; } Before this commit you either have to completely overload find and rewrite it in the AppModel or call the before to get the modified `$query` and let cake run the before again. |
||
---|---|---|
.. | ||
Behavior | ||
Datasource | ||
Validator | ||
AclNode.php | ||
Aco.php | ||
AcoAction.php | ||
Aro.php | ||
BehaviorCollection.php | ||
CakeSchema.php | ||
ConnectionManager.php | ||
I18nModel.php | ||
Model.php | ||
ModelBehavior.php | ||
ModelValidator.php | ||
Permission.php |