cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@ish.com.au>
Subject Re: 3.0 cache documentation
Date Wed, 13 May 2009 23:19:27 GMT

On 13/05/2009, at 11:28 PM, Borut BolĨina wrote:

> Now a question. Let's say I create a select query on paintings with  
> OSCache
> cache group paintings. Lets say there are 3 paintings: p1, p2 and p3.
>
> Now they are cached in object cache and in separete query cache? Two  
> cache
> entries?

Correct. Two different types of cache.

> Let's say I create another painting and insert it into the db. The new
> painting p4 is now in object cache. If I want to have fresh list of
> paintings, I now have to invalidate the paintings cache group in the
> onCommit callback function.

If you way you fetch that list is through another query on the current  
context, then yes, you need to invalidate the query cache.

> Is there an alternative, like simply adding this
> p4 to cache group paintings?

You can't do that. But you can maintain your own List of paintings and  
add the new one to that. Remember that Cayenne does no in-memory  
evaluation of the query so it cannot know whether your new painting  
belongs in the list of (say) paintings starting with "A".


> If not, will the subsequent fetch contact the db for all p1-p4 or is  
> there a
> way that paintings will get fetched from object cache if they are  
> there? I
> want to avoid reading (tens of)thousands of rows because  
> occasionally some
> get inserted.

 From Andrus' previous reply, the fresh query against the db will read  
in all the relevant objects and replace them in the object cache. So  
effective the object cache is used for following relations, but not  
when performing a fresh query against the db.

Ari



-------------------------->
ish
http://www.ish.com.au
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



Mime
View raw message