Permalink
Browse files

Redcing key name when using groups in MemcacheEngine

  • Loading branch information...
1 parent 27b90b0 commit afba5aafb7fd821907d6ee2ce0c4aaa9350388ad @lorenzo lorenzo committed Mar 27, 2012
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/Cake/Cache/Engine/MemcacheEngine.php
@@ -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])) {
@@ -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;

0 comments on commit afba5aa

Please sign in to comment.