3 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
7 * Please see the LICENSE file distributed with this source code for further
8 * information regarding copyright and licensing.
10 * Please visit the following links to read about the usage policies and the license of
11 * OpenWeatherMap before using this class:
13 * @see http://www.OpenWeatherMap.org
14 * @see http://www.OpenWeatherMap.org/terms
15 * @see http://openweathermap.org/appid
18 namespace Cmfcmf\OpenWeatherMap;
21 * Abstract cache class to be overwritten by custom cache implementations.
23 abstract class AbstractCache
26 * @var int $seconds Cache time in seconds.
31 * Checks whether a cached weather data is available.
33 * @param string $url The unique url of the cached content.
35 * @return bool False if no cached information is available, otherwise true.
37 * You need to check if a cached result is outdated here. Return false in that case.
39 abstract public function isCached($url);
42 * Returns cached weather data.
44 * @param string $url The unique url of the cached content.
46 * @return string|bool The cached data if it exists, false otherwise.
48 abstract public function getCached($url);
51 * Saves cached weather data.
53 * @param string $url The unique url of the cached content.
54 * @param string $content The weather data to cache.
56 * @return bool True on success, false on failure.
58 abstract public function setCached($url, $content);
61 * Set after how much seconds the cache shall expire.
65 public function setSeconds($seconds)
67 $this->seconds = $seconds;