EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.descriptors.invalidation
Class TimeToLiveCacheInvalidationPolicy

java.lang.Object
  extended by org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy
      extended by org.eclipse.persistence.descriptors.invalidation.TimeToLiveCacheInvalidationPolicy
All Implemented Interfaces:
java.io.Serializable

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
protected  long timeToLive
           
 
Fields inherited from class org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy
NO_EXPIRY, shouldRefreshInvalidObjectsInUnitOfWork, shouldUpdateReadTimeOnUpdate
 
Constructor Summary
TimeToLiveCacheInvalidationPolicy()
          INTERNAL: Default Constructor for Project XML Unless the timeToLive is set by method, objects will expire immediately
TimeToLiveCacheInvalidationPolicy(long timeToLive)
          PUBLIC: Construct a TimeToLiveCacheInvalidationPolicy
 
Method Summary
 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, isInvalidated, setShouldRefreshInvalidObjectsInUnitOfWork, setShouldUpdateReadTimeOnUpdate, shouldRefreshInvalidObjectsInUnitOfWork, shouldUpdateReadTimeOnUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeToLive

protected long timeToLive
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 class CacheInvalidationPolicy

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 class CacheInvalidationPolicy

setTimeToLive

public void setTimeToLive(long timeToLive)
PUBLIC: Set the time-to-live specified by this policy


EclipseLink1.0 - 20080707 API Reference