Class WeatherCache
- java.lang.Object
-
- org.silverpeas.looks.aurora.service.weather.WeatherCache
-
@Technical @Bean @Singleton public class WeatherCache extends Object
Cache of weather forecast data coming from a weather service.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description WeatherCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeatherForecastData
get(String cityId, Supplier<WeatherForecastData> supplier)
Gets the weather forecast data from the cache or invokes the specified supplier if no such data are in the cache or if the data is expired.
-
-
-
Method Detail
-
get
public final WeatherForecastData get(String cityId, Supplier<WeatherForecastData> supplier)
Gets the weather forecast data from the cache or invokes the specified supplier if no such data are in the cache or if the data is expired. If the supplier is invoked, the returned data is then automatically cached.- Parameters:
cityId
- the unique identifier of a city.supplier
- a supplier ofWeatherForecastData
instance.- Returns:
- a
WeatherForecastData
instance.
-
-