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

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

Introduction

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

Prototype

public static Object get(String key, WebCacheItem wci) 

Source Link

Usage

From source file:com.liferay.portlet.amazonrankings.util.AmazonRankingsUtil.java

License:Open Source License

public static AmazonRankings getAmazonRankings(String isbn) {
    if (!Validator.isDigit(isbn)) {
        return null;
    }// w ww  . jav  a 2  s .  c o  m

    WebCacheItem wci = new AmazonRankingsWebCacheItem(isbn);

    return (AmazonRankings) WebCachePoolUtil.get(AmazonRankingsUtil.class.getName() + StringPool.PERIOD + isbn,
            wci);
}

From source file:com.liferay.portlet.currencyconverter.util.CurrencyUtil.java

License:Open Source License

public static Currency getCurrency(String symbol) {
    WebCacheItem wci = new CurrencyWebCacheItem(symbol);

    return (Currency) WebCachePoolUtil.get(CurrencyUtil.class.getName() + StringPool.PERIOD + symbol, wci);
}

From source file:com.liferay.portlet.network.util.NetworkUtil.java

License:Open Source License

public static DNSLookup getDNSLookup(String domain) {
    WebCacheItem wci = new DNSLookupWebCacheItem(domain);

    return (DNSLookup) WebCachePoolUtil.get(NetworkUtil.class.getName() + ".dnslookup." + domain, wci);
}

From source file:com.liferay.portlet.network.util.NetworkUtil.java

License:Open Source License

public static Whois getWhois(String domain) {
    WebCacheItem wci = new WhoisWebCacheItem(domain);

    return (Whois) WebCachePoolUtil.get(NetworkUtil.class.getName() + ".whois." + domain, wci);
}

From source file:com.liferay.portlet.rss.util.RSSUtil.java

License:Open Source License

public static ObjectValuePair<String, SyndFeed> getFeed(String url) {
    WebCacheItem wci = new RSSWebCacheItem(url);

    return new ObjectValuePair<String, SyndFeed>(url,
            (SyndFeed) WebCachePoolUtil.get(RSSUtil.class.getName() + StringPool.PERIOD + url, wci));
}

From source file:com.liferay.randombibleverse.util.RBVUtil.java

License:Open Source License

private Verse _getVerse(String location, String versionId, String language) {

    WebCacheItem webCacheItem = new VerseWebCacheItem(location, versionId, language);

    return (Verse) WebCachePoolUtil.get(
            RBVUtil.class.getName() + StringPool.PERIOD + location + StringPool.PERIOD + versionId,
            webCacheItem);/*from   w  w w .j a v  a 2  s .  co m*/
}

From source file:com.liferay.rss.web.internal.util.RSSFeed.java

License:Open Source License

public SyndFeed getSyndFeed() {
    if (_syndFeed != null) {
        return _syndFeed;
    }/*ww  w  . j  a  v  a 2 s.co  m*/

    WebCacheItem wci = new RSSWebCacheItem(_rssWebCacheConfiguration, _url);

    _syndFeed = (SyndFeed) WebCachePoolUtil.get(RSSFeed.class.getName() + StringPool.PERIOD + _url, wci);

    return _syndFeed;
}

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   www . ja  v a2 s .  co m
        return (Stocks) WebCachePoolUtil.get(key, wci);
    } catch (ClassCastException cce) {
        WebCachePoolUtil.remove(key);

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

From source file:com.liferay.taglib.util.GetUrlTag.java

License:Open Source License

@Override
public int doEndTag() throws JspException {
    try {/* w  w w .ja va2  s .  c  o  m*/
        WebCacheItem wci = new GetUrlWebCacheItem(_url, _expires);

        String content = (String) WebCachePoolUtil.get(GetUrlTag.class.getName() + StringPool.PERIOD + _url,
                wci);

        if (Validator.isNotNull(_var)) {
            pageContext.setAttribute(_var, content);
        } else {
            JspWriter jspWriter = pageContext.getOut();

            jspWriter.print(content);
        }

        return EVAL_PAGE;
    } catch (Exception e) {
        throw new JspException(e);
    }
}

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.  j  av a  2  s  .  c o  m
        if (events.size() > 0) {
            Event event = events.get(0);
        }
    } catch (ClassCastException cce) {
        WebCachePoolUtil.remove(key);

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

    return events;
}