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
**/
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 = apc_fetch($groups);
$groups = apc_fetch($this->_compiledGroupNames);
if (count($groups) !== count($this->settings['groups'])) {
foreach ($this->_compiledGroupNames as $group) {
if (!isset($groups[$group])) {
@ -163,8 +161,9 @@ class ApcEngine extends CacheEngine {
}
$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;
}