BigMemory 4.3.10 | Product Documentation | BigMemory Max Configuration Guide | Defining a Distributed Configuration | Cache Events Configuration
 
Cache Events Configuration
The <cache> sub-element <cacheEventListenerFactory>, which registers listeners for cache events such as puts and updates, has a notification scope controlled by the attribute listenFor. This attribute can have one of the following values:
*local– Listen for events on the local node. No remote events are detected.
*remote – Listen for events on other nodes. No local events are detected.
*local – (DEFAULT) Listen for events on both the local node and on remote nodes.
In order for cache events to be detected by remote nodes in a Terracotta cluster, event listeners must have a scope that includes remote events. For example, the following configuration allows listeners of type MyCacheListener to detect both local and remote events:
<cache name="myCache" ... >
<!-- Not defining the listenFor attribute for <cacheEventListenerFactory> is by default equivalent to listenFor="all". -->
<cacheEventListenerFactory
class="net.sf.ehcache.event.TerracottaCacheEventReplicationFactory" />
<terracotta />
</cache>
You must use net.sf.ehcache.event.TerracottaCacheEventReplicationFactory as the factory class to enable cluster-wide cache-event broadcasts in a Terracotta cluster.
For more information about cache events in a Terracotta cluster, see "Cache Event Listeners" in the Developers Guide for BigMemory Max.