cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Object Cache and Child Objects - Cayenne 3.1
Date Wed, 18 May 2016 14:11:06 GMT
> I have a question and an observation. While reading some of the Cayenne
> code, we've noticed reference to a snapshot cache. Is this the object
> cache, or something different?

Correct. This is shared object cache.

> The issue we are seeing has to do with cayenne objects that are
> parents/children of other cayenne objects. For instance, we have a User
> object, we also have Staff and Patient objects that are children of the
> User object.

By parent/child you mean superclass/subclass?

> 
> What we have seen is that if a developer does a query for a User object by
> id, the object is retrieved. Cayenne sees that this object is a Staff
> object and then stores it in the object cache as a Staff object. The next
> time the user goes to retrieve the User object (by the same id), Cayenne
> does another call to the database, because it cannot find the User object
> in the cache (because it stored it as a Staff object).

Could be a bug. Which API are you using? Cayenne.objectForPK(..) ?

Andrus



> On May 18, 2016, at 4:31 PM, Frank Herrmann <frank.herrmann@modernizingmedicine.com>
wrote:
> 
> Hello all,
> 
> I have a question and an observation. While reading some of the Cayenne
> code, we've noticed reference to a snapshot cache. Is this the object
> cache, or something different?
> 
> The issue we are seeing has to do with cayenne objects that are
> parents/children of other cayenne objects. For instance, we have a User
> object, we also have Staff and Patient objects that are children of the
> User object.
> 
> What we have seen is that if a developer does a query for a User object by
> id, the object is retrieved. Cayenne sees that this object is a Staff
> object and then stores it in the object cache as a Staff object. The next
> time the user goes to retrieve the User object (by the same id), Cayenne
> does another call to the database, because it cannot find the User object
> in the cache (because it stored it as a Staff object).
> 
> Thanks again for the help.
> 
> -Frank
> 
> -- 
> FRANK HERRMANN
> SOFTWARE ENGINEER
> 
> T: 561-880-2998 x1563
> 
> E: frank.herrmann@modmed.com
> 
> 
> 
> [image: [ Modernizing Medicine ]] <http://www.modmed.com/>
> [image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine> [image:
> [ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/> [image:
> [ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [
> Twitter ]] <https://twitter.com/modmed_EMA> [image: [ Blog ]]
> <http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]]
> <http://instagram.com/modernizing_medicine>


Mime
View raw message