Skip to content

Commit

Permalink
Refactoring to remove some duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 10, 2010
1 parent 1cf5e72 commit 7ad4068
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cake/libs/view/view.php
Expand Up @@ -334,18 +334,17 @@ public function element($name, $params = array(), $callbacks = false) {
}

if (isset($params['cache'])) {
$keys = array_merge(array($plugin, $name), array_keys($params));
$caching = array(
'config' => $this->elementCache,
'key' => implode('_', $keys)
);
if (is_array($params['cache'])) {
$defaults = array(
'config' => $this->elementCache,
'key' => $plugin . '_' . $name,
'key' => $caching['key']
);
$caching = array_merge($defaults, $params['cache']);
} else {
$keys = array_merge(array($plugin, $name), array_keys($params));
$caching = array(
'config' => $this->elementCache,
'key' => implode('_', $keys)
);
}
$key = 'element_' . $caching['key'];
$contents = Cache::read($key, $caching['config']);
Expand Down

0 comments on commit 7ad4068

Please sign in to comment.