public class TimedItem
extends java.lang.Object
TimedItem currentStories = new TimedItem(60000);
public ArrayList getCurrentStories()
{
ArrayList storyList = (ArrayList) currentStories.get();
if (storyList == null) {
storyList = DB.queryStoryDatabase();
currentStories.put(storyList);
}
return storyList;
}
Constructor and Description |
---|
TimedItem(long expireInterval)
Create a new timed item with a specified update time
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get()
Gets the cached value, returning null if expires.
|
long |
getExpireInterval()
Returns the expire time for this TimedItem.
|
void |
put(java.lang.Object value)
Sets the value.
|
void |
setExpireInterval(long expireInterval)
Sets the expire time for this timedItem.
|
public TimedItem(long expireInterval)
expireInterval
- the time in milliseconds the item remains valid.public long getExpireInterval()
public void setExpireInterval(long expireInterval)
public void put(java.lang.Object value)
public java.lang.Object get()