net.dontdrinkandroot.lastfm.api.ws

## Class DefaultLastfmWebServices

- java.lang.Object
- - net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices
  - - net.dontdrinkandroot.lastfm.api.ws.DefaultLastfmWebServices

All Implemented Interfaces:
  LastfmWebServices

    public class DefaultLastfmWebServices
    extends AbstractLastfmWebServices

### Field Summary

### Fields inherited from class net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices

`logger`

### Constructor Summary

Constructors
Constructor and Description
`DefaultLastfmWebServices(String key, String secret)` Set up the WebServices with the required components.
`DefaultLastfmWebServices(String key, String secret, Cache cache)` Set up the WebServices with the required components.
`DefaultLastfmWebServices(String key, String secret, Cache cache, Fetcher fetcher)`

### Method Summary

Methods
`protected Serializable` `getFromCache(Map<String,String> parameters)` Try to fetch the result from cache.
`protected Serializable` `putToCache(Map<String,String> parameters, Serializable result, long timeToLive)` Store result in cache.

### Methods inherited from class net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices

`execute, fetch, fetch, getApiKey, getApiSecret, getFetcher, setFetcher, setTimeToLive`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultLastfmWebServices

    public DefaultLastfmWebServices(String key,
                            String secret)
                             throws ParserConfigurationException

Set up the WebServices with the required components.

Parameters:
  `key` - The last.fm API key, see http://www.last.fm/api/account
  `secret` - The last.fm API secret, see http://www.last.fm/api/account
Throws:
  `ParserConfigurationException`

#### DefaultLastfmWebServices

    public DefaultLastfmWebServices(String key,
                            String secret,
                            Cache cache)
                             throws ParserConfigurationException

Set up the WebServices with the required components.

Parameters:
  `key` - The last.fm API key, see http://www.last.fm/api/account
  `secret` - The last.fm API secret, see http://www.last.fm/api/account
  `cache` - The cache implementation
Throws:
  `ParserConfigurationException`

#### DefaultLastfmWebServices

    public DefaultLastfmWebServices(String key,
                            String secret,
                            Cache cache,
                            Fetcher fetcher)

### Method Detail

#### getFromCache

    protected Serializable getFromCache(Map<String,String> parameters)

Try to fetch the result from cache.

Specified by:
  `getFromCache` in class `AbstractLastfmWebServices`
Parameters:
  `id` - Id to lookup.
Returns:
  The entry if found or null.

#### putToCache

    protected Serializable putToCache(Map<String,String> parameters,
                          Serializable result,
                          long timeToLive)

Store result in cache.

Specified by:
  `putToCache` in class `AbstractLastfmWebServices`
Parameters:
  `id` - The id to store the entry for.
  `result` - The query result.
  `timeToLive` - The time to live for the cache entry.
Returns:
  The cached result or the original result on caching errors.