Index: branches/5.1.x/core/units/helpers/menu_helper.php =================================================================== diff -u -N -r13086 -r13168 --- branches/5.1.x/core/units/helpers/menu_helper.php (.../menu_helper.php) (revision 13086) +++ branches/5.1.x/core/units/helpers/menu_helper.php (.../menu_helper.php) (revision 13168) @@ -115,24 +115,41 @@ if (!$root_cat) { $root_cat = $this->Application->ModuleInfo['Core']['RootCat']; + $cache_key = 'parent_paths[%CIDSerial:' . $root_cat . '%]'; + $root_path = $this->Application->getCache($cache_key); - $sql = 'SELECT ParentPath - FROM ' . TABLE_PREFIX . 'Category - WHERE CategoryId = ' . $root_cat; - $root_path = $this->Conn->GetOne($sql); + if ($root_path === false) { + $this->Conn->nextQueryCachable = true; + $sql = 'SELECT ParentPath + FROM ' . TABLE_PREFIX . 'Category + WHERE CategoryId = ' . $root_cat; + $root_path = $this->Conn->GetOne($sql); + $this->Application->setCache($cache_key, $root_path); + } } if (!$this->Menu) { - $menu = $this->Conn->GetRow('SELECT Data, Cached FROM '.TABLE_PREFIX.'Cache WHERE VarName = "cms_menu"'); - if ($menu && $menu['Cached'] > 0) { - $menu = unserialize($menu['Data']); + if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) { + $menu = $this->Application->getCache('master:cms_menu', false); + } + else { + $menu = $this->Application->getDBCache('cms_menu'); + } + + if ($menu) { + $menu = unserialize($menu); $this->parentPaths = $menu['parentPaths']; } else { $menu = $this->_altBuildMenuStructure(Array ('CategoryId' => $root_cat, 'ParentPath' => $root_path)); $menu['parentPaths'] = $this->parentPaths; - $this->Conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("cms_menu", '.$this->Conn->qstr(serialize($menu)).', '.adodb_mktime().')'); + if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) { + $this->Application->setCache('master:cms_menu', serialize($menu)); + } + else { + $this->Application->setDBCache('cms_menu', serialize($menu)); + } } unset($menu['parentPaths']);