org.apache.cayenne.lifecycle.cache
Class CacheInvalidationFilter

java.lang.Object
  extended by org.apache.cayenne.lifecycle.cache.CacheInvalidationFilter
All Implemented Interfaces:
DataChannelFilter

public class CacheInvalidationFilter
extends Object
implements DataChannelFilter

A DataChannelFilter that invalidates cache groups defined for mapped entities via CacheGroups annotations.

Since:
3.1

Constructor Summary
CacheInvalidationFilter()
           
 
Method Summary
protected  void addCacheGroups(Set<String> groupSet, Object object)
          A method that builds a list of cache groups for a given object and adds them to the invalidation group set.
 void init(DataChannel channel)
           
 QueryResponse onQuery(ObjectContext originatingContext, Query query, DataChannelFilterChain filterChain)
           
 GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType, DataChannelFilterChain filterChain)
           
protected  void preCommit(Object object)
          A callback method that records cache group to flush at the end of the commit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheInvalidationFilter

public CacheInvalidationFilter()
Method Detail

init

public void init(DataChannel channel)
Specified by:
init in interface DataChannelFilter

onQuery

public QueryResponse onQuery(ObjectContext originatingContext,
                             Query query,
                             DataChannelFilterChain filterChain)
Specified by:
onQuery in interface DataChannelFilter

onSync

public GraphDiff onSync(ObjectContext originatingContext,
                        GraphDiff changes,
                        int syncType,
                        DataChannelFilterChain filterChain)
Specified by:
onSync in interface DataChannelFilter

preCommit

@PrePersist(entityAnnotations=CacheGroups.class)
@PreRemove(entityAnnotations=CacheGroups.class)
@PreUpdate(entityAnnotations=CacheGroups.class)
protected void preCommit(Object object)
A callback method that records cache group to flush at the end of the commit.


addCacheGroups

protected void addCacheGroups(Set<String> groupSet,
                              Object object)
A method that builds a list of cache groups for a given object and adds them to the invalidation group set. This implementation adds all groups defined via CacheGroups annotation for a given class. Subclasses may override this method to provide more fine-grained filtering of cache groups to invalidate, based on the state of the object.



Copyright © 2001-2013 Apache Cayenne. All Rights Reserved.