de.umass.lastfm.cache
public class DefaultExpirationPolicy extends Object implements ExpirationPolicy
Modifier and Type | Field and Description |
---|---|
protected long |
cacheRecentWeeklyCharts
Contains the expiration time for weekly chart data for the current week, which is
one week by default; last.fm TOS says:
"You agree to cache similar artist and any chart data (top tracks, top artists, top albums) for a minimum of one week."
but they might be outdated the next day.
|
protected static long |
ONE_DAY
One day in milliseconds
|
protected static long |
ONE_WEEK
One week in milliseconds
|
protected static Set<String> |
ONE_WEEK_METHODS
Contains method names for all requests that should be cached 1 week
|
Constructor and Description |
---|
DefaultExpirationPolicy() |
Modifier and Type | Method and Description |
---|---|
long |
getExpirationTime(String method,
Map<String,String> params)
Returns the time in milliseconds a request of the given method should be cached.
|
void |
setCacheRecentWeeklyCharts(long cacheRecentWeeklyCharts) |
protected static final long ONE_DAY
protected static final long ONE_WEEK
protected static final Set<String> ONE_WEEK_METHODS
protected long cacheRecentWeeklyCharts
setCacheRecentWeeklyCharts(long)
method to set this value.
This variable also applies to the getWeeklyChartList methodpublic long getExpirationTime(String method, Map<String,String> params)
ExpirationPolicy
getExpirationTime
in interface ExpirationPolicy
method
- The method calledparams
- The parameters sentpublic void setCacheRecentWeeklyCharts(long cacheRecentWeeklyCharts)