Package org.jboss.util
Class TimedCachePolicy.DefaultTimedEntry
- java.lang.Object
-
- org.jboss.util.TimedCachePolicy.DefaultTimedEntry
-
- All Implemented Interfaces:
TimedCachePolicy.TimedEntry
- Enclosing class:
- TimedCachePolicy
static class TimedCachePolicy.DefaultTimedEntry extends java.lang.Object implements TimedCachePolicy.TimedEntry
The default implementation of TimedEntry used to wrap non-TimedEntry objects inserted into the cache.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) long
expirationTime
(package private) java.lang.Object
value
-
Constructor Summary
Constructors Constructor Description DefaultTimedEntry(long lifetime, java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Notify the entry that it has been removed from the cache.java.lang.Object
getValue()
void
init(long now)
Initializes an entry with the current cache time.boolean
isCurrent(long now)
Is the entry still valid basis the current timeboolean
refresh()
Attempt to extend the entry lifetime by refreshing it.
-
-
-
Method Detail
-
init
public void init(long now)
Description copied from interface:TimedCachePolicy.TimedEntry
Initializes an entry with the current cache time. This is called when the entry is first inserted into the cache so that entries do not have to know the absolute system time.- Specified by:
init
in interfaceTimedCachePolicy.TimedEntry
-
isCurrent
public boolean isCurrent(long now)
Description copied from interface:TimedCachePolicy.TimedEntry
Is the entry still valid basis the current time- Specified by:
isCurrent
in interfaceTimedCachePolicy.TimedEntry
- Returns:
- true if the entry is within its lifetime, false if it is expired.
-
refresh
public boolean refresh()
Description copied from interface:TimedCachePolicy.TimedEntry
Attempt to extend the entry lifetime by refreshing it.- Specified by:
refresh
in interfaceTimedCachePolicy.TimedEntry
- Returns:
- true if the entry was refreshed successfully, false otherwise.
-
destroy
public void destroy()
Description copied from interface:TimedCachePolicy.TimedEntry
Notify the entry that it has been removed from the cache.- Specified by:
destroy
in interfaceTimedCachePolicy.TimedEntry
-
getValue
public java.lang.Object getValue()
- Specified by:
getValue
in interfaceTimedCachePolicy.TimedEntry
- Returns:
- the value component of the TimedEntry. This may or may not be the TimedEntry implementation.
-
-