com.opensymphony.oscache.extra
Class CacheEntryEventListenerImpl

java.lang.Object
  extended by com.opensymphony.oscache.extra.CacheEntryEventListenerImpl
All Implemented Interfaces:
CacheEntryEventListener, CacheEventListener, EventListener

public class CacheEntryEventListenerImpl
extends Object
implements CacheEntryEventListener

Implementation of a CacheEntryEventListener. It use the events to count the operations performed on the cache.

We are not using any synchronized so that this does not become a bottleneck. The consequence is that on retrieving values, the operations that are currently being done won't be counted.

Version:
$Revision: 254 $
Author:
Alain Bergevin, Chris Miller

Field Summary
private  int cacheFlushedCount
          Counter for the cache flushes
private  int entryAddedCount
          Counter for the added entries
private  int entryFlushedCount
          Counter for the flushed entries
private  int entryRemovedCount
          Counter for the removed entries
private  int entryUpdatedCount
          Counter for the updated entries
private  int groupFlushedCount
          Counter for the flushed groups
private  int patternFlushedCount
          Counter for the pattern flushes
 
Constructor Summary
CacheEntryEventListenerImpl()
          Constructor, empty for us
 
Method Summary
 void cacheEntryAdded(CacheEntryEvent event)
          Handles the event fired when an entry is added in the cache.
 void cacheEntryFlushed(CacheEntryEvent event)
          Handles the event fired when an entry is flushed from the cache.
 void cacheEntryRemoved(CacheEntryEvent event)
          Handles the event fired when an entry is removed from the cache.
 void cacheEntryUpdated(CacheEntryEvent event)
          Handles the event fired when an entry is updated in the cache.
 void cacheFlushed(CachewideEvent event)
          Handles the event fired when a cache flush occurs.
 void cacheGroupFlushed(CacheGroupEvent event)
          Handles the event fired when a group is flushed from the cache.
 void cachePatternFlushed(CachePatternEvent event)
          Handles the event fired when a pattern is flushed from the cache.
 int getCacheFlushedCount()
          Gets the cache flush counter
 int getEntryAddedCount()
          Gets the add counter
 int getEntryFlushedCount()
          Gets the flushed counter
 int getEntryRemovedCount()
          Gets the removed counter
 int getEntryUpdatedCount()
          Gets the updated counter
 int getGroupFlushedCount()
          Gets the group flush counter
 int getPatternFlushedCount()
          Gets the pattern flush counter
 String toString()
          Returns the internal values in a string form
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cacheFlushedCount

private int cacheFlushedCount
Counter for the cache flushes


entryAddedCount

private int entryAddedCount
Counter for the added entries


entryFlushedCount

private int entryFlushedCount
Counter for the flushed entries


entryRemovedCount

private int entryRemovedCount
Counter for the removed entries


entryUpdatedCount

private int entryUpdatedCount
Counter for the updated entries


groupFlushedCount

private int groupFlushedCount
Counter for the flushed groups


patternFlushedCount

private int patternFlushedCount
Counter for the pattern flushes

Constructor Detail

CacheEntryEventListenerImpl

public CacheEntryEventListenerImpl()
Constructor, empty for us

Method Detail

getEntryAddedCount

public int getEntryAddedCount()
Gets the add counter

Returns:
The added counter

getEntryFlushedCount

public int getEntryFlushedCount()
Gets the flushed counter

Returns:
The flushed counter

getEntryRemovedCount

public int getEntryRemovedCount()
Gets the removed counter

Returns:
The removed counter

getEntryUpdatedCount

public int getEntryUpdatedCount()
Gets the updated counter

Returns:
The updated counter

getGroupFlushedCount

public int getGroupFlushedCount()
Gets the group flush counter

Returns:
The number of group flush calls that have occurred

getPatternFlushedCount

public int getPatternFlushedCount()
Gets the pattern flush counter

Returns:
The number of pattern flush calls that have occurred

getCacheFlushedCount

public int getCacheFlushedCount()
Gets the cache flush counter

Returns:
The number of times the entire cache has been flushed

cacheEntryAdded

public void cacheEntryAdded(CacheEntryEvent event)
Handles the event fired when an entry is added in the cache.

Specified by:
cacheEntryAdded in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache entry has been added

cacheEntryFlushed

public void cacheEntryFlushed(CacheEntryEvent event)
Handles the event fired when an entry is flushed from the cache.

Specified by:
cacheEntryFlushed in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache entry has been flushed

cacheEntryRemoved

public void cacheEntryRemoved(CacheEntryEvent event)
Handles the event fired when an entry is removed from the cache.

Specified by:
cacheEntryRemoved in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache entry has been removed

cacheEntryUpdated

public void cacheEntryUpdated(CacheEntryEvent event)
Handles the event fired when an entry is updated in the cache.

Specified by:
cacheEntryUpdated in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache entry has been updated

cacheGroupFlushed

public void cacheGroupFlushed(CacheGroupEvent event)
Handles the event fired when a group is flushed from the cache.

Specified by:
cacheGroupFlushed in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache group has been flushed

cachePatternFlushed

public void cachePatternFlushed(CachePatternEvent event)
Handles the event fired when a pattern is flushed from the cache.

Specified by:
cachePatternFlushed in interface CacheEntryEventListener
Parameters:
event - The event triggered when a cache pattern has been flushed

cacheFlushed

public void cacheFlushed(CachewideEvent event)
Handles the event fired when a cache flush occurs.

Specified by:
cacheFlushed in interface CacheEntryEventListener
Parameters:
event - The event triggered when an entire cache is flushed

toString

public String toString()
Returns the internal values in a string form

Overrides:
toString in class Object


Copyright © 2011 OpenSymphony. All Rights Reserved.