Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing method cache from DboSource::conditions() this was consuming…

… too much memory and bringing little to no performance increase
  • Loading branch information...
commit ca0a7e4271a161f6abdcebf6a20717de26e7e893 1 parent b603232
@lorenzo lorenzo authored
Showing with 5 additions and 24 deletions.
  1. +5 −24 lib/Cake/Model/Datasource/DboSource.php
View
29 lib/Cake/Model/Datasource/DboSource.php
@@ -2287,25 +2287,6 @@ public function fields($model, $alias = null, $fields = array(), $quote = true)
* @return string SQL fragment
*/
public function conditions($conditions, $quoteValues = true, $where = true, $model = null) {
- if (is_object($model)) {
- $cacheKey = array(
- $model->useDbConfig,
- $model->table,
- $model->schema(),
- $model->name,
- $model->getVirtualField(),
- $conditions,
- $quoteValues,
- $where
- );
- } else {
- $cacheKey = array($conditions, $quoteValues, $where);
- }
- $cacheKey = crc32(serialize($cacheKey));
- if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) {
- return $return;
- }
-
$clause = $out = '';
if ($where) {
@@ -2316,16 +2297,16 @@ public function conditions($conditions, $quoteValues = true, $where = true, $mod
$out = $this->conditionKeysToString($conditions, $quoteValues, $model);
if (empty($out)) {
- return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . ' 1 = 1');
+ return $clause . ' 1 = 1';
}
- return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . implode(' AND ', $out));
+ return $clause . implode(' AND ', $out);
}
if (is_bool($conditions)) {
- return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . (int)$conditions . ' = 1');
+ return $clause . (int)$conditions . ' = 1';
}
if (empty($conditions) || trim($conditions) === '') {
- return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . '1 = 1');
+ return $clause . '1 = 1';
}
$clauses = '/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i';
@@ -2333,7 +2314,7 @@ public function conditions($conditions, $quoteValues = true, $where = true, $mod
$clause = '';
}
$conditions = $this->__quoteFields($conditions);
- return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . $conditions);
+ return $clause . $conditions;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.