缓存分类

来源:互联网 发布:windows to go 激活 编辑:程序博客网 时间:2024/06/18 06:30
public function set_category_cache($categorys) {$cache_array = array();foreach ($categorys as $category) {if($category['modelid'] != 1) continue;$parentid = $category['parentid'];$categoryid = $category['catid'];$need_cache = false;if ($parentid == 0) {$need_cache = true;} else if(is_array($pp = $categorys[$parentid])) {if ($pp['parentid'] == 0) {$need_cache = true;}}if($need_cache)$cache_array[$parentid][$categoryid] = $categorys[$categoryid];}foreach($cache_array as $key => $values) {setcache('category_content_'. $key ."_". $this->siteid, $values, 'commons');}}