cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <>
Subject Re: Removing Cayenne cache groups
Date Sat, 29 May 2010 04:22:36 GMT
Sorry for my late reply.

On 28/05/2010 00:48, Bryan Lewis wrote:
> This email made me aware of that cool new removeGroup and OSCache features.
> Thanks.  Two little howevers...
> In my testing, it worked only with LOCAL_CACHE, as the original poster
> said.  Not a big deal for me; SHARED_CACHE is rarely necessary.  The same
> was true with OSCache.

Did some more testing (and reading Gary Jarrel's thread[1]) and it turns out I've misunderstood
LOCAL vs SHARED caching. I now understand that:

- LOCAL_CACHE is cached in a QueryCache at the ObjectContext level
- SHARED_CACHE is cached in a QueryCache at the DataDomain level
- These two cached are independent e.g. invoking removeGroups on the ObjectContext QueryCache
clear the DataDomain QueryCache.

The Java example in the doco ( shows
to clear the cache in a post-commit callback, but it targets the ObjectContext cache, in other

In order to clear a group from the SHARED_CACHE one needs to lookup the DataDomain's QueryCache
invoke removeGroup on that cache. The following seems to work:

void onCommit() {
   QueryCache cache = customer.getDataContext().getParentDataDomain().getQueryCache();
   if(isModern()) {
   else {

That said, DataObject.getDataContext is deprecated. What is the recommended way to lookup
DataDomain from inside a DataObject callback? Configuration.getSharedConfiguration().getDomain()?

Kind regards



View raw message