net.roarsoftware.lastfm.cache
Interface ScrobbleCache

All Known Implementing Classes:
FileSystemCache

public interface ScrobbleCache

A ScrobbleCache is able to cache SubmissionData instances for later submission to the Last.fm servers.

Author:
Janni Kovacs

Method Summary
 void cacheScrobble(java.util.Collection<SubmissionData> submissions)
          Caches a collection of SubmissionData.
 void cacheScrobble(SubmissionData... submissions)
          Caches one or more SubmissionData.
 void clearScrobbleCache()
          Clears all cached scrobbles from this cache.
 boolean isEmpty()
          Checks if the cache contains any scrobbles.
 void scrobble(Scrobbler scrobbler)
          Tries to scrobble all cached scrobbles.
 

Method Detail

cacheScrobble

void cacheScrobble(SubmissionData... submissions)
Caches one or more SubmissionData.

Parameters:
submissions - The submissions

cacheScrobble

void cacheScrobble(java.util.Collection<SubmissionData> submissions)
Caches a collection of SubmissionData.

Parameters:
submissions - The submissions

isEmpty

boolean isEmpty()
Checks if the cache contains any scrobbles.

Returns:
true if this cache is empty

scrobble

void scrobble(Scrobbler scrobbler)
              throws java.io.IOException
Tries to scrobble all cached scrobbles. If it succeeds the cache will be empty afterwards. If this method fails an IOException is thrown and no entries are removed from the cache.

Parameters:
scrobbler - A Scrobbler instance
Throws:
java.io.IOException - on I/O errors
java.lang.IllegalStateException - if the Scrobbler is not fully initialized (i.e. no handshake performed)

clearScrobbleCache

void clearScrobbleCache()
Clears all cached scrobbles from this cache.