[Phphtmllib-devel] SF.net SVN: phphtmllib:[3505] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-06-17 21:30:18
|
Revision: 3505 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3505&view=rev Author: hemna Date: 2010-06-17 21:30:11 +0000 (Thu, 17 Jun 2010) Log Message: ----------- move caching Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 20:51:49 UTC (rev 3504) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 21:30:11 UTC (rev 3505) @@ -54,6 +54,13 @@ public function process_airport($icao) { + $cache_key = "METAR_".$icao; + $info = $this->cache->get($cache_key); + if ($info) { + $wxInfo = $info; + return $wxInfo; + } + $wxInfo = array("icao" => strtoupper($icao)); $metar = $this->get_metar($icao, $wxInfo); @@ -79,7 +86,8 @@ //$this->metars[] = $wxInfo; //need to combine this info w/ the airport data cache. } - + + $this->cache->set($cache_key, $wxInfo, AviationWeather::METAR_CACHE_TIMEOUT); return $wxInfo; } @@ -144,14 +152,6 @@ public function get_metar($station, &$wxInfo) { - $cache_key = "METAR_".$station; - - $info = $this->cache->get($cache_key); - if ($info) { - $wxInfo = $info; - $metar = $wxInfo["metar"]; - return $metar; - } // This function retrieves METAR information for a given station from the // National Weather Service. It assumes that the station exists. // A slower URL is "ftp://weather.noaa.gov/data/observations/metar/stations/$station.TXT" @@ -179,7 +179,6 @@ $wxInfo["metar"] = $metar; - $this->cache->set($cache_key, $wxInfo, AviationWeather::METAR_CACHE_TIMEOUT); return $metar; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |