You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Fr...@capgroup.com on 2008/03/28 01:49:28 UTC

Where in the code does open jpa call get and put for the L2 cache

I am considering implementing L2caching myself with openjpa.
Since it is open source and there is little L2 caching support at the
moment I thought I might as well just do it.

Reading the doc I first found the RemotCommitProvider stuff - but this is
not what I am looking for.
It seems to be about communicating events to other server in some
distributed scenario. But this type of functionality is already provided by
any caching system already. So I have no need for it and I intend to let
the cache do that itself...
So I should have zero need to implement this type of functionality. I am
not trying to reinvent caching - this has been done and well done before.
Maybe this was done to support the custom openjpa caching stuff - I don't
know.
But to integrate with a JCache - all I need to know is where the get and
put calls are made - and that's it.

All I need is to find the hook where openjpa decide to check the cache for
content and where openjpa put something in the cache.
For example - in the case of a simple object graph - I would assume that
when I select the parent object - openjpa will check the cache:
- 1 - Is the parent in the L2 cache.
- 2 - are the related objects in the L2 cache (based on cascade.select
etc..).

I am also assuming the cache check arre always done at the entity type
granularity level. By that I mean I do one check for the parent object -
and I do one check (and only one) for all the same entity type children (in
a one to many scenario) (basically I want to do a getAll() of course).

So there must be a piece of code somewhere that do the get and put in the
L2 cache.
I mean openjpa does all the complicated stuff - relationship mapping -
dynamic sql query - etc... All I need is L2 cache support. If my
assumptions are correct about how openjpa talks to a l2cache - then I
should be able to do proper L2 cache support in no time at all... I mean
gosh if it is designed properly the whole thing can be done in less than a
day.

Am I missing something?

Can anyone tell me where to look to find the L2 cache calls being made?
I already know the RemoteCommitProvider is not done for that at all - so
where should I look?

Frederic


Re: Where in the code does open jpa call get and put for the L2 cache

Posted by Fr...@capgroup.com.
I just replied to the other email before I read this one.

So I looked into that namespace yesterday. I thought it was kind of what I
was looking for.
But the method take an objectID - so how would I get the name of the cache
from the object id?

For example the method
    protected abstract DataCachePCData removeInternal(Object oid);

I was thinking this is the one I will need to override - if correct - then
how do I get the entity metadata from the oid?

Frederic



                                                                           
             Pinaki Poddar                                                 
             <ppoddar@apache.o                                             
             rg>                                                        To 
                                       users@openjpa.apache.org            
                                                                        cc 
             03/28/2008 10:29                                              
             AM                                                    Subject 
                                       Re: Where in the code does open jpa 
                                       call get and put for the L2 cache   
             Please respond to                                             
             users@openjpa.apa                                             
                  che.org                                                  
                                                                           
                                                                           
                                                                           





Satrt looking from
  interface org.apache.openjpa.datacache.DataCache

And its abstract implementation is a good place to extend
   abstract class org.apache.openjpa.datacache.AbstractDataCache

Once you implement your own L2 caches (possibly as an extension of
AbstractDataCache) -- OpenJPA will wire up your implementation merely by
configuration.
--
View this message in context:
http://www.nabble.com/Where-in-the-code-does-open-jpa-call-get-and-put-for-the-L2-cache-tp16343557p16355903.html

Sent from the OpenJPA Users mailing list archive at Nabble.com.




Re: Where in the code does open jpa call get and put for the L2 cache

Posted by Pinaki Poddar <pp...@apache.org>.
Satrt looking from
  interface org.apache.openjpa.datacache.DataCache

And its abstract implementation is a good place to extend
   abstract class org.apache.openjpa.datacache.AbstractDataCache

Once you implement your own L2 caches (possibly as an extension of
AbstractDataCache) -- OpenJPA will wire up your implementation merely by
configuration. 
-- 
View this message in context: http://www.nabble.com/Where-in-the-code-does-open-jpa-call-get-and-put-for-the-L2-cache-tp16343557p16355903.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.