Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Redcing key name when using groups in MemcacheEngine
  • Loading branch information
lorenzo committed Mar 27, 2012
1 parent 27b90b0 commit afba5aa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/Cake/Cache/Engine/MemcacheEngine.php
Expand Up @@ -251,15 +251,13 @@ public function connect($host, $port = 11211) {
* @return array
**/
public function groups() {
$groups = $this->_compiledGroupNames;
if (empty($groups)) {
if (empty($this->_compiledGroupNames)) {
foreach ($this->settings['groups'] as $group) {
$groups[] = $this->settings['prefix'] . $group;
$this->_compiledGroupNames[] = $this->settings['prefix'] . $group;
}
$this->_compiledGroupNames = $groups;
}

$groups = $this->_Memcache->get($groups);
$groups = $this->_Memcache->get($this->_compiledGroupNames);
if (count($groups) !== count($this->settings['groups'])) {
foreach ($this->_compiledGroupNames as $group) {
if (!isset($groups[$group])) {
Expand All @@ -271,8 +269,9 @@ public function groups() {
}

$result = array();
foreach ($groups as $group => $value) {
$result[] = $group . $value;
$groups = array_values($groups);
foreach ($this->settings['groups'] as $i => $group) {
$result[] = $group . $groups[$i];
}

return $result;
Expand Down

0 comments on commit afba5aa

Please sign in to comment.