org.apache.cocoon.caching
Interface EventRegistry

All Superinterfaces:
Component
All Known Implementing Classes:
AbstractDoubleMapEventRegistry, DefaultEventRegistryImpl, StoreEventRegistryImpl

public interface EventRegistry
extends Component

The EventRegistry is responsible for the two-way many-to-many mapping between cache Events and PipelineCacheKeys necessary to allow for efficient event-based cache invalidation. Because persistence and recovery between application shutdown and startup are internal concerns they are not defined here even though it is expected that most real-world implementers of this interface would require these features. On the other hand, EventRegistry must help the Cache to ensure that outdated content is never served, even if that means discarding potentially valid cached entries. For this reason, wasRecoverySuccessful() is defined here as part of the public contract with the Cache.

Since:
2.1
Version:
CVS $Id: EventRegistry.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Geoff Howard

Field Summary
static String ROLE
          The Avalon ROLE for this component
 
Method Summary
 Serializable[] allKeys()
          Retrieve an array of all keys regardless of event mapping, or null if no keys are registered..
 void clear()
          Clear all event-key mappings from the registry.
 Serializable[] keysForEvent(Event e)
          Retrieve an array of all keys mapped to this event.
 void register(Event e, Serializable key)
          Map an event to a key
 void removeKey(Serializable key)
          Remove all occurances of the specified key from the registry.
 boolean wasRecoverySuccessful()
          Returns whether the registry was successful in retrieving its persisted state during startup.
 

Field Detail

ROLE

static final String ROLE
The Avalon ROLE for this component

Method Detail

register

void register(Event e,
              Serializable key)
Map an event to a key

Parameters:
e - event
key - key

removeKey

void removeKey(Serializable key)
Remove all occurances of the specified key from the registry.

Parameters:
key - - The key to remove.

keysForEvent

Serializable[] keysForEvent(Event e)
Retrieve an array of all keys mapped to this event.

Parameters:
e - event
Returns:
an array of keys which should not be modified or null if no keys are mapped to this event.

allKeys

Serializable[] allKeys()
Retrieve an array of all keys regardless of event mapping, or null if no keys are registered..

Returns:
an array of keys which should not be modified

clear

void clear()
Clear all event-key mappings from the registry.


wasRecoverySuccessful

boolean wasRecoverySuccessful()
Returns whether the registry was successful in retrieving its persisted state during startup. If recovering persisted data was not successful, the component must signal that the Cache may contain orphaned EventValidity objects by returning false. The Cache should then ensure that all pipelines associated with EventValidities are either removed or re-associated (if possible).

Returns:
true if the Component recovered its state successfully, false otherwise.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.