/** * 更新房源小区缓存 * * @param array $list 房源信息 * @param int $tradetype * @param int $prop_type 待上架/普通/推荐 * @param int $brokerid */ private function update_cached_prop_communitys($list, $tradetype, $prop_type, $brokerid) { if ($tradetype == 1 && $prop_type == 0) { //出售待上架 $index = Const_My::KEY_UnSale_Comm; } elseif ($tradetype == 1 && $prop_type == 1) { //出售普通房源 $index = Const_My::KEY_OnSale_Normal_Comm; } elseif ($tradetype == 1 && $prop_type == 2) { //出售推荐房源 $index = Const_My::KEY_OnSale_Recommend_Comm; } elseif ($tradetype == 2 && $prop_type == 0) { //出租待上架 $index = Const_My::KEY_UnRent_Comm; } elseif ($tradetype == 2 && $prop_type == 1) { //出租普通房源 $index = Const_My::KEY_OnRent_Normal_Comm; } elseif ($tradetype == 2 && $prop_type == 2) { //出租推荐房源 $index = Const_My::KEY_onRent_Recommend_Comm; } //获取memcache $memcache = APF_Cache_Factory::get_instance()->get_memcache(); $key = Util_MemCacheKey::get_propmanagement_commids($brokerid); $time = Util_MemCacheTime::get_propmanagement_commids(); $communitys_list = $memcache->get($key); if (is_array($communitys_list[$index])) { foreach ($list as $prop) { if (!array_key_exists($prop["CommId"], $communitys_list[$index])) { $communitys_list[$index][$prop["CommId"]]++; } } } //更新cache $memcache->set($key, $communitys_list, 0, $time); }