cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Caching query results
Date Mon, 25 Sep 2006 14:01:53 GMT
Until 3.0 invalidating query lists was totally up to the developer.

In 3.0 we added three things - RefreshQuery (mentioned by Ari),  
"query cache group" concept, and pluggable QueryCache. This makes  
clustering and refresh policy management much simpler. I am running  
this latest code (3.0 trunk essentially) in pre-production  
environment on a cluster using OSQueryCache and it work extremely well.

I am going to document it better at some point (maybe even write an  
article). For now please post on the list if you have more questions  
about that. Essentially I do something like this:

dataDomain.setQueryCacheFactory(new OSQueryCacheFactory());

and then configure "" with group refresh policies  
(see OSQueryCache javadocs and OSCache framework documentation for  

Once you have this set up, you can build in more bells and whistles  
if you wish. For instance I implemented the following extensions on a  
customer project:

* a web console for interactive cache group invalidation on the cluster.
* hooks to invalidate certain groups when certain entities are  
modified by the user via another new 3.0 feature - callbacks (I am  
going to write an overview of callbacks soon).


On Sep 25, 2006, at 9:34 AM, Aristedes Maniatis wrote:
> On 25/09/2006, at 10:41 PM, Francesco Fuzio wrote:
>> <<It is important to understand that caching of *result lists* is  
>> done independently from caching of *individual DataObjects and  
>> DataRows*. Therefore the API is different as well. Also cached  
>> results lists _are not synchronized across VMs (even the shared  
>> cache)._>>_
>> _So it seems that if my application is deployed in a cluster I  
>> have to implement a custom _distributed_ invalidation mechanism.
> It depends on how important it is that the data is up to date. One  
> solution might be to add functionality to Cayenne which invalidates  
> objects in the cache after a certain period of time (for instance 1  
> hour). It is now possible to invalidate objects one at time (http:// 
> We are examining the same problem in our application (not a web  
> cluster, but a client/server application). For now we switched off  
> caching, but we need to think through the issues. One solution is  
> to implement a distributing messaging system to send notifications  
> between clients - I think Andrus was looking at XMPP at one time  
> ( for this. Certainly it would be  
> handy if a messaging system was built into Cayenne for this. It  
> would also be useful for things like pessimistic locking.
> Ari Maniatis
> -------------------------->
> ish
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message