|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.caucho.util.TimedItem
public class TimedItem
A single item timed cache. The item will remain valid until it expires. TimedItem can simplify database caching.
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 Summary | |
---|---|
TimedItem(long expireInterval)
Create a new timed item with a specified update time |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimedItem(long expireInterval)
expireInterval
- the time in milliseconds the item remains valid.Method Detail |
---|
public long getExpireInterval()
public void setExpireInterval(long expireInterval)
public void put(java.lang.Object value)
public java.lang.Object get()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |