com.googlecode.ehcache.annotations
Interface TriggersRemoveInterceptor

All Known Implementing Classes:
DefaultTriggersRemoveInterceptor

public interface TriggersRemoveInterceptor

Used by TriggersRemove to allow logic to be injected into the triggers remove API. Remove workflow looks like:

  1. If TriggersRemove.when() is set to When.BEFORE_METHOD_INVOCATION, proceed with method invocation and capture the returned value
  2. Generate cache key
  3. ForEach TriggersRemove.cacheName():
    1. Call preInvokeTriggersRemove(Ehcache, MethodInvocation, Serializable)
    2. If preInvokeTriggersRemove returns true remove the key from the cache
  4. If TriggersRemove.when() is set to When.AFTER_METHOD_INVOCATION, proceed with method invocation and capture the returned value
Remove All workflow looks like:
  1. If TriggersRemove.when() is set to When.BEFORE_METHOD_INVOCATION, proceed with method invocation and capture the returned value
  2. ForEach TriggersRemove.cacheName():
    1. Call preInvokeTriggersRemoveAll(Ehcache, MethodInvocation)
    2. If preInvokeTriggersRemoveAll returns true removeAll is called on the cache
  3. If TriggersRemove.when() is set to When.AFTER_METHOD_INVOCATION, proceed with method invocation and capture the returned value

Version:
$Revision: 656 $
Author:
Eric Dalquist

Method Summary
 boolean preInvokeTriggersRemove(net.sf.ehcache.Ehcache cache, org.aopalliance.intercept.MethodInvocation methodInvocation, java.io.Serializable key)
          Called before the element is removed from the cache
 boolean preInvokeTriggersRemoveAll(net.sf.ehcache.Ehcache cache, org.aopalliance.intercept.MethodInvocation methodInvocation)
          Called before the elements are removed from the cache
 

Method Detail

preInvokeTriggersRemove

boolean preInvokeTriggersRemove(net.sf.ehcache.Ehcache cache,
                                org.aopalliance.intercept.MethodInvocation methodInvocation,
                                java.io.Serializable key)
Called before the element is removed from the cache

Parameters:
cache - The cache used for this invocation
methodInvocation - The method invocation that has been intercepted
key - The generated cache key
Returns:
true if the element should be removed, false if the remove should be skipped.

preInvokeTriggersRemoveAll

boolean preInvokeTriggersRemoveAll(net.sf.ehcache.Ehcache cache,
                                   org.aopalliance.intercept.MethodInvocation methodInvocation)
Called before the elements are removed from the cache

Parameters:
cache - The cache used for this invocation
methodInvocation - The method invocation that has been intercepted
Returns:
true if the elements should be removed, false if the remove should be skipped.


Copyright © 2011. All Rights Reserved.