org.xmlecho.palomar.cache
Class TTLPolicy
java.lang.Object
org.xmlecho.palomar.cache.TTLPolicy
- All Implemented Interfaces:
- Policy
- public class TTLPolicy
- extends java.lang.Object
- implements Policy
Class defines the Time To Live(TTL) policy. Encapsulates the
details of the life time of a cache object. Given a cached object,
this can determine the objects expired state.
|
Constructor Summary |
TTLPolicy(long lifeTime)
construct with time to live in seconds |
|
Method Summary |
long |
getLifeTime()
Method for getting the life time of a cached object |
java.lang.String |
getTag()
Method for simple identification of a policy. |
boolean |
hasExpired(Holder objectHolder)
Evaluates the state of a cached object. |
void |
setLifeTimeHours(long lifeTime)
sets the life time for a cached object |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TTLPolicy
public TTLPolicy(long lifeTime)
- construct with time to live in seconds
hasExpired
public boolean hasExpired(Holder objectHolder)
- Evaluates the state of a cached object. If true, the
object may be refreshed/deleted from the cache.
- Specified by:
hasExpired in interface Policy
- Parameters:
objectHolder - the object to be analysed for its state.- See Also:
ObjectHolder
setLifeTimeHours
public void setLifeTimeHours(long lifeTime)
- sets the life time for a cached object
- Parameters:
lifeTime - time in seconds
getLifeTime
public long getLifeTime()
- Method for getting the life time of a cached object
getTag
public java.lang.String getTag()
- Method for simple identification of a policy.
- Specified by:
getTag in interface Policy
- Returns:
- String the name of the policy
toString
public java.lang.String toString()