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:
<object-cache
class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl">
<attribute attribute-name="cacheExcludes" attribute-value=""/>
<attribute attribute-name="applicationCache"
attribute-value="edu.iu.uis.database.ObjectCacheOSCacheImpl"/>
<attribute attribute-name="copyStrategy"
attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$Cop
yStrategyImpl"/>
<attribute attribute-name="forceProxies" attribute-value="false"/>
</object-cache>
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]