Reducing key size when using groups in ApcEngine

This commit is contained in:
Jose Lorenzo Rodriguez 2012-03-27 00:01:34 -04:30
parent 2100a64ffd
commit 27b90b0e47

View file

@ -143,15 +143,13 @@ class ApcEngine extends CacheEngine {
* @return array * @return array
**/ **/
public function groups() { public function groups() {
$groups = $this->_compiledGroupNames; if (empty($this->_compiledGroupNames)) {
if (empty($groups)) {
foreach ($this->settings['groups'] as $group) { foreach ($this->settings['groups'] as $group) {
$groups[] = $this->settings['prefix'] . $group; $this->_compiledGroupNames[] = $this->settings['prefix'] . $group;
} }
$this->_compiledGroupNames = $groups;
} }
$groups = apc_fetch($groups); $groups = apc_fetch($this->_compiledGroupNames);
if (count($groups) !== count($this->settings['groups'])) { if (count($groups) !== count($this->settings['groups'])) {
foreach ($this->_compiledGroupNames as $group) { foreach ($this->_compiledGroupNames as $group) {
if (!isset($groups[$group])) { if (!isset($groups[$group])) {
@ -163,8 +161,9 @@ class ApcEngine extends CacheEngine {
} }
$result = array(); $result = array();
foreach ($groups as $group => $value) { $groups = array_values($groups);
$result[] = $group . $value; foreach ($this->settings['groups'] as $i => $group) {
$result[] = $group . $groups[$i];
} }
return $result; return $result;
} }