function get_appgame_oembed_content($api_prefix, $ori_url) { if ($res = get_cache_data($ori_url)) { return $res; } if ($res = get_cache_data($ori_url . ERROR_NAME)) { return $res; } $can_save = false; $res_body = get_oembed_from_api($api_prefix, $ori_url); $return = make_oembed_template($res_body, $ori_url, $can_save); if ($can_save) { put_cache_data($ori_url, $return); error_log('new done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']); } else { put_cache_data($ori_url . ERROR_NAME, $return); //资料不全?需要通知相关人等 error_log('not done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']); } return $return; }
/** * 地区缓存数据 * 将所有地区数据读取出来 如果没有缓存则生成缓存 * @return array 地区数据 * @author 李东 * @date 2015-06-16 */ function get_area_cache() { $cache_name = 'area_data'; if (!F($cache_name)) { $cache_result = get_result('area', array('status' => 1), '', 'sort desc'); $result = get_cache_data($cache_result, $cache_name); } else { $result = F($cache_name); } return $result; }