Example usage for com.liferay.portal.kernel.webcache WebCachePoolUtil remove

List of usage examples for com.liferay.portal.kernel.webcache WebCachePoolUtil remove

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.webcache WebCachePoolUtil remove.

Prototype

public static void remove(String key) 

Source Link

Usage

From source file:com.liferay.stocks.util.StocksUtil.java

License:Open Source License

public static Stocks getStocks(String symbol) {
    WebCacheItem wci = new StocksWebCacheItem(symbol);

    String key = StocksUtil.class.getName() + StringPool.PERIOD + symbol;

    try {/*from  w  w  w . ja  v  a2  s  .c  o m*/
        return (Stocks) WebCachePoolUtil.get(key, wci);
    } catch (ClassCastException cce) {
        WebCachePoolUtil.remove(key);

        return (Stocks) WebCachePoolUtil.get(key, wci);
    }
}

From source file:com.liferay.tich.util.TICHUtil.java

License:Open Source License

public static List<Event> getEvents() {
    WebCacheItem wci = new EventsWebCacheItem();

    String key = TICHUtil.class.getName();

    List<Event> events = (List<Event>) WebCachePoolUtil.get(key, wci);

    try {/*from ww w.ja v a 2  s  .  com*/
        if (events.size() > 0) {
            Event event = events.get(0);
        }
    } catch (ClassCastException cce) {
        WebCachePoolUtil.remove(key);

        events = (List<Event>) WebCachePoolUtil.get(key, wci);
    }

    return events;
}

From source file:com.liferay.weather.util.WeatherUtil.java

License:Open Source License

public static Weather getWeather(String zip) {
    String key = WeatherUtil.class.getName() + StringPool.PERIOD + zip;

    WebCacheItem wci = new WeatherWebCacheItem(zip);

    try {/* ww w.jav  a2 s  .com*/
        return (Weather) WebCachePoolUtil.get(key, wci);
    } catch (ClassCastException cce) {
        WebCachePoolUtil.remove(key);

        return (Weather) WebCachePoolUtil.get(key, wci);
    }
}