com.sapportals.wcm.util.cache

Interface IClusterCacheArea


public interface IClusterCacheArea

Represents a cacheable area. A cacheable area is identified by its unique ID. An area is either in state valid or invalid. These states are toggled by the following events:

from event to side-effect
VALID validate() VALID initial state, calling validate() won't do anything.
VALID invalidate() VALID calling invalidate() will send an INVALIDATE event and update the getLastNodeInvalidation() timestamp.
VALID INVALIDATE INVALID an INVALIDATE event from other cluster nodes invalidates the cache area and updates the getLastClusterInvalidation() timestamp.
INVALID INVALIDATE INVALID INVALIDATE event in INVALID state just update the getLastClusterInvalidation() timestamp.
INVALID invalidate() INVALID calling invalidate() will send an INVALIDATE event and update the getLastNodeInvalidation() timestamp.
INVALID validate() VALID calling validate() toogles the state back to VALID.
For example used by the IDMapper.


Method Summary
 String getAreaID()
          Get the area's ID.
 long getClusterTimeout()
          Get the cluster cache timeout.
 long getLastClusterInvalidation()
          Get the timestamp of the last (external) invalidation from other cluster nodes.
 long getLastInvalidation()
          Get the timestamp of the last invalidation (internally or externally, the later one).
 long getLastNodeInvalidation()
          Get the timestamp of the last (internal) invalidation from this node.
 void invalidate()
          Mark this cache area as invalid.
 boolean isCluster()
          Get the cluster's cache flag.
 boolean isValid()
          Check, if this cache area is marked as invalid.
 void refresh(ICache cache)
          Remove all expired entries from the given cache (does a cache.removeEntriesOlderThan(getLastClusterInvalidation())).
 void validate()
          Mark this cache area as valid.
 

Method Detail

getAreaID

public String getAreaID()
Get the area's ID.

Returns:
a String, which holds the area's ID.

isCluster

public boolean isCluster()
Get the cluster's cache flag.

Returns:
true if the system is running in cluster mode.

getClusterTimeout

public long getClusterTimeout()
Get the cluster cache timeout.

Returns:
a long with the system's cluster cache timeout in msec.

validate

public void validate()
Mark this cache area as valid. Changes the state from INVALID to VALID.


refresh

public void refresh(ICache cache)
             throws CacheException
Remove all expired entries from the given cache (does a cache.removeEntriesOlderThan(getLastClusterInvalidation())).

Parameters:
cache - the ICache to remove expired entries from.
Throws:
CacheException

invalidate

public void invalidate()
Mark this cache area as invalid. Sends an INVALIDATE event to the other cluster nodes but doesn't change the state.


isValid

public boolean isValid()
Check, if this cache area is marked as invalid.

Returns:
true, if state is VALID.

getLastInvalidation

public long getLastInvalidation()
Get the timestamp of the last invalidation (internally or externally, the later one).

Returns:
the timestamp of the last invalidation, the later timestamp from getLastExternalInvalidation() and getLastInternalInvalidation().

getLastClusterInvalidation

public long getLastClusterInvalidation()
Get the timestamp of the last (external) invalidation from other cluster nodes.

Returns:
a long with the timestamp of the last incoming INVALIDATE event.

getLastNodeInvalidation

public long getLastNodeInvalidation()
Get the timestamp of the last (internal) invalidation from this node.

Returns:
a long with the timestamp of the last call to invalidate().


Copyright 2006 SAP AG Complete Copyright Notice