Top Description Fields Constructors Methods
org.eclipse.persistence.descriptors.invalidation

public Class DailyCacheInvalidationPolicy

extends CacheInvalidationPolicy
Class Inheritance
Imports
java.util.*, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

PUBLIC: A CacheInvalidationPolicy that allows objects to expire every day at a specific time. A daily cache invalidation policy is created with an hour, minute, second and millisecond when objects will expire. Objects will expire in the cache every day at that time.
See Also
CacheInvalidationPolicy

Field Summary

Modifier and TypeField and Description
protected Calendar
protected Calendar
Inherited from org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy:
isInvalidationRandomizedNO_EXPIRYrandomshouldRefreshInvalidObjectsOnCloneshouldUpdateReadTimeOnUpdate

Constructor Summary

AccessConstructor and Description
public
DailyCacheInvalidationPolicy()

INTERNAL: Default constructor for Project XML if setters are not called to set expiry times, expiry time will be the time of day at which this object is instantiated.

public
DailyCacheInvalidationPolicy(int hour, int minute, int second, int millisecond)

PUBLIC: Construct a daily policy that will allow objects to expire at a specific time of day.

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.clone.

Creates and returns a copy of this object.
public Calendar
getExpiryTime()

INTERNAL: Get the expiry time as a Calendar.

public long
public void
incrementExpiry()

INTERNAL: Update the expiry time to be the day after the current day.

public boolean
isInvalidated(CacheKey key, long currentTimeMillis)

Implements abstract org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.isInvalidated.

INTERNAL: Return true if this object has expire or is invalid
public void
setExpiryTime(int hour, int minute, int second, int millisecond)

PUBLIC: Set a new expiry time for this object Provide the hour, minute, second and millisecond.

public void
setExpiryTime(Calendar calendar)

INTERNAL: Set the expiry time based on a Calendar.

Inherited from org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy:
getRemainingValidTimeinitializeisInvalidatedisInvalidationRandomizedsetIsInvalidationRandomizedsetShouldRefreshInvalidObjectsOnClonesetShouldUpdateReadTimeOnUpdateshouldRefreshInvalidObjectsOnCloneshouldUpdateReadTimeOnUpdate

Field Detail

expiryTimeback to summary
protected Calendar expiryTime
previousExpiryback to summary
protected Calendar previousExpiry

Constructor Detail

DailyCacheInvalidationPolicyback to summary
public DailyCacheInvalidationPolicy()

INTERNAL: Default constructor for Project XML if setters are not called to set expiry times, expiry time will be the time of day at which this object is instantiated.

DailyCacheInvalidationPolicyback to summary
public DailyCacheInvalidationPolicy(int hour, int minute, int second, int millisecond)

PUBLIC: Construct a daily policy that will allow objects to expire at a specific time of day. Provide the hour, minute, second and millisecond. Objects that make use of this policy will be set to expire at that exact time every day.

Method Detail

cloneback to summary
public Object clone()

Overrides org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
getExpiryTimeback to summary
public Calendar getExpiryTime()

INTERNAL: Get the expiry time as a Calendar. Used for setting the expiry time in deployment XML

getExpiryTimeInMillisback to summary
public long getExpiryTimeInMillis(CacheKey key)

Implements abstract org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.getExpiryTimeInMillis.

INTERNAL: Return the next expiry time.

Annotations
@Override
incrementExpiryback to summary
public void incrementExpiry()

INTERNAL: Update the expiry time to be the day after the current day.

isInvalidatedback to summary
public boolean isInvalidated(CacheKey key, long currentTimeMillis)

Implements abstract org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.isInvalidated.

INTERNAL: Return true if this object has expire or is invalid

Annotations
@Override
setExpiryTimeback to summary
public void setExpiryTime(int hour, int minute, int second, int millisecond)

PUBLIC: Set a new expiry time for this object Provide the hour, minute, second and millisecond. Objects which make use of this policy will be set to expire at that exact time every day.

setExpiryTimeback to summary
public void setExpiryTime(Calendar calendar)

INTERNAL: Set the expiry time based on a Calendar. Used for setting the expiry time from deployment XML.