public class FeedCache extends AbstractLogEnabled implements Component, Initializable
| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
FeedCache.FeedCacheLoader
The feed cache loader, delegates the loading to the component's loadFeed method (to be easily overridable). 
 | 
protected class  | 
FeedCache.FeedLoadWorker
Runnable loading an URL into the cache. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
protected LoadingCache<String,FeedResult> | 
_cache
The user information cache. 
 | 
static String | 
ROLE
The component role. 
 | 
| Constructor and Description | 
|---|
FeedCache()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected CloseableHttpClient | 
_getHttpClient()
Build a HttpClient object 
 | 
FeedResult | 
getFeed(String feedUrl,
       int lifeTime)
Get a feed. 
 | 
FeedResult | 
getFeedNoCache(String feedUrl)
Get a feed not from the cache. 
 | 
void | 
initialize()  | 
protected FeedResult | 
loadFeed(String feedUrl)
Retrieve a feed's content to store it into the cache. 
 | 
void | 
preload(Collection<String> feeds)
Pre-load a collection of feeds, one by thread, to avoid getting timeouts sequentially. 
 | 
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprotected LoadingCache<String,FeedResult> _cache
public FeedCache()
public void initialize() throws Exception
initialize in interface InitializableExceptionpublic void preload(Collection<String> feeds)
feeds - the feeds to preload.public FeedResult getFeedNoCache(String feedUrl) throws IOException
feedUrl - the feed.IOException - if an error occurs while loading the feedpublic FeedResult getFeed(String feedUrl, int lifeTime)
feedUrl - the feed.lifeTime - the amount of date or time to be added to the fieldprotected CloseableHttpClient _getHttpClient()
protected FeedResult loadFeed(String feedUrl) throws IOException
feedUrl - the feed to load.IOException - if an error occurs with the HttpURLConnection