com.sun.syndication.fetcher.impl
Class HashMapFeedInfoCache

java.lang.Object
  extended bycom.sun.syndication.fetcher.impl.HashMapFeedInfoCache
All Implemented Interfaces:
FeedFetcherCache, Serializable

public class HashMapFeedInfoCache
extends Object
implements FeedFetcherCache, Serializable

A very simple implementation of the FeedFetcherCache interface.

This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible for sort term (client aggregator?) use, as the memory usage will increase over time as the number of feeds in the cache increases.

Author:
Nick Lothian
See Also:
Serialized Form

Field Summary
(package private) static HashMapFeedInfoCache _instance
           
private  Map infoCache
           
static long serialVersionUID
           
 
Constructor Summary
HashMapFeedInfoCache()
          Constructor for HashMapFeedInfoCache Only use this if you want multiple instances of the cache.
 
Method Summary
protected  Object get(Object key)
           
 SyndFeedInfo getFeedInfo(URL feedUrl)
          Get a SyndFeedInfo object from the cache.
protected  Map getInfoCache()
           
static FeedFetcherCache getInstance()
          Get the global instance of the cache
protected  void put(Object key, Object value)
           
 void setFeedInfo(URL feedUrl, SyndFeedInfo syndFeedInfo)
          Add a SyndFeedInfo object to the cache
protected  void setInfoCache(Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

_instance

static HashMapFeedInfoCache _instance

infoCache

private Map infoCache
Constructor Detail

HashMapFeedInfoCache

public HashMapFeedInfoCache()

Constructor for HashMapFeedInfoCache

Only use this if you want multiple instances of the cache. Usually getInstance() is more appropriate.

Method Detail

getInstance

public static FeedFetcherCache getInstance()
Get the global instance of the cache

Returns:
an implementation of FeedFetcherCache

get

protected Object get(Object key)

getFeedInfo

public SyndFeedInfo getFeedInfo(URL feedUrl)
Description copied from interface: FeedFetcherCache
Get a SyndFeedInfo object from the cache.

Specified by:
getFeedInfo in interface FeedFetcherCache
Parameters:
feedUrl - The url of the feed
Returns:
A SyndFeedInfo or null if it is not in the cache
See Also:
FeedFetcherCache.getFeedInfo(java.net.URL)

put

protected void put(Object key,
                   Object value)

setFeedInfo

public void setFeedInfo(URL feedUrl,
                        SyndFeedInfo syndFeedInfo)
Description copied from interface: FeedFetcherCache
Add a SyndFeedInfo object to the cache

Specified by:
setFeedInfo in interface FeedFetcherCache
Parameters:
feedUrl - The url of the feed
syndFeedInfo - A SyndFeedInfo for the feed
See Also:
FeedFetcherCache.setFeedInfo(java.net.URL, com.sun.syndication.fetcher.impl.SyndFeedInfo)

getInfoCache

protected Map getInfoCache()

setInfoCache

protected void setInfoCache(Map map)