Re: Question about two-level cache
Hi Eric, Westfall, Eric Curtis wrote: Hello, I'm wondering if anyone out there has experience using OJB's two-level caching. I am attempting to use a two-level cache to help speed up an application I'm working on and I'm noticing some issues that I'm curious about. It appears that, even if my object is already in the application cache, OJB is still issuing the SQL to query for the object (verified using P6Spy). Is this what's actually happening or am I mistaken? The two-level cache hold a "flat" (without referenced objects) copy of the cached object. If OJB lookup an object from cache the non-proxy, auto-retrieve 1:n and n:m references of the cached flat object have to be materialized too. In this case OJB query the referenced objects. Too avoid this use proxied references http://db.apache.org/ojb/docu/guides/basic-technique.html#Using+a+Single+Proxy+for+a+Whole+Collection or the 'forceProxies' attribute http://db.apache.org/ojb/docu/guides/objectcache.html#ObjectCacheTwoLevelImpl I can see in certain cases where OJB would need to run the query in order to get a set of primary keys to check the cache for, however, if I'm doing a query by the primary key shouldn't it just go straight to the application cache without hitting the database? yep, if you lookup objects by Identity http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key except if the object has non-proxy, auto-retrieve 1:n and n:m references - see above. regards, Armin I'm using OSCache as my application cache, here's my configuration: Thanks in advance, Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about two-level cache
Hi, I experienced Two Level Cache Impl. Have a look to mail archives about TwoLevelCacheImpl. Beware of checkpoints inside batch loops. Using checkpoints make cached objects quantity growing until commit. If you have to, replace checkpoints by commit/begin. Did you try the ObjectCacheDefaultImpl instead of OSCacheImpl ? If you do ReportQuery or read Collections with criteria, then i beleive that cache is not used (partially used in Collection retrieving). I mean SQL query is done , to find data / or PK. So you can see queries crossing in P6spy. I'm interrested in your experiences of 2 Level Cache, especially in the setting with the kind of model/processes. Regards. On 4/22/06, Westfall, Eric Curtis <[EMAIL PROTECTED]> wrote: > > Hello, I'm wondering if anyone out there has experience using OJB's > two-level caching. I am attempting to use a two-level cache to help > speed up an application I'm working on and I'm noticing some issues that > I'm curious about. > > It appears that, even if my object is already in the application cache, > OJB is still issuing the SQL to query for the object (verified using > P6Spy). Is this what's actually happening or am I mistaken? I can see > in certain cases where OJB would need to run the query in order to get a > set of primary keys to check the cache for, however, if I'm doing a > query by the primary key shouldn't it just go straight to the > application cache without hitting the database? I'm using OSCache as my > application cache, here's my configuration: > > class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl"> > > attribute-value="edu.iu.uis.database.ObjectCacheOSCacheImpl"/> > attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$Cop > yStrategyImpl"/> > > > > Thanks in advance, > Eric > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >