PHPCMS缓存分类

	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');
		}
	}

猜你喜欢

转载自blog.csdn.net/g0ose/article/details/77864912