Class TimeToLiveCacheInvalidationPolicy
- java.lang.Object
-
- org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy
-
- org.eclipse.persistence.descriptors.invalidation.TimeToLiveCacheInvalidationPolicy
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class TimeToLiveCacheInvalidationPolicy extends CacheInvalidationPolicy
PUBLIC: A CacheInvalidationPolicy which allows objects to live for a specific amount of time after they are read. A TimeToLiveCacheInvalidationPolicy is instantiated with a specific number of milliseconds. This represents how long after an object is read it will expire.- See Also:
CacheInvalidationPolicy
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
timeToLive
Number of milliseconds before invalidation.-
Fields inherited from class org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy
isInvalidationRandomized, NO_EXPIRY, random, shouldRefreshInvalidObjectsOnClone, shouldUpdateReadTimeOnUpdate
-
-
Constructor Summary
Constructors Constructor Description TimeToLiveCacheInvalidationPolicy()
INTERNAL: Default Constructor for Project XML Unless the timeToLive is set by method, objects will expire immediatelyTimeToLiveCacheInvalidationPolicy(long timeToLive)
PUBLIC: Construct a TimeToLiveCacheInvalidationPolicy
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
long
getExpiryTimeInMillis(org.eclipse.persistence.internal.identitymaps.CacheKey key)
INTERNAL: Return the next expiry time.long
getTimeToLive()
PUBLIC: Return the time-to-live specified for this policy.boolean
isInvalidated(org.eclipse.persistence.internal.identitymaps.CacheKey key, long currentTimeMillis)
INTERNAL: Return true if this object is set as invalid or has expired.void
setTimeToLive(long timeToLive)
PUBLIC: Set the time-to-live specified by this policy.-
Methods inherited from class org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy
getRemainingValidTime, initialize, isInvalidated, isInvalidationRandomized, setIsInvalidationRandomized, setShouldRefreshInvalidObjectsInUnitOfWork, setShouldRefreshInvalidObjectsOnClone, setShouldUpdateReadTimeOnUpdate, shouldRefreshInvalidObjectsInUnitOfWork, shouldRefreshInvalidObjectsOnClone, shouldUpdateReadTimeOnUpdate
-
-
-
-
Constructor Detail
-
TimeToLiveCacheInvalidationPolicy
public TimeToLiveCacheInvalidationPolicy()
INTERNAL: Default Constructor for Project XML Unless the timeToLive is set by method, objects will expire immediately
-
TimeToLiveCacheInvalidationPolicy
public TimeToLiveCacheInvalidationPolicy(long timeToLive)
PUBLIC: Construct a TimeToLiveCacheInvalidationPolicy- Parameters:
timeToLive
- the number of milliseconds an object affected by this policy will live.
-
-
Method Detail
-
getExpiryTimeInMillis
public long getExpiryTimeInMillis(org.eclipse.persistence.internal.identitymaps.CacheKey key)
INTERNAL: Return the next expiry time.- Specified by:
getExpiryTimeInMillis
in classCacheInvalidationPolicy
-
getTimeToLive
public long getTimeToLive()
PUBLIC: Return the time-to-live specified for this policy.
-
isInvalidated
public boolean isInvalidated(org.eclipse.persistence.internal.identitymaps.CacheKey key, long currentTimeMillis)
INTERNAL: Return true if this object is set as invalid or has expired.- Specified by:
isInvalidated
in classCacheInvalidationPolicy
-
setTimeToLive
public void setTimeToLive(long timeToLive)
PUBLIC: Set the time-to-live specified by this policy.
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classCacheInvalidationPolicy
-
-