Me again :)
I looked into the source code of ObjectCacheDefaultImpl and
ObjectCachePerBrokerImpl
and now I see the difference on how the cache is handled.
Global cache
>ObjectCacheDefaultImpl
protected static Map objectTable = new Hashtable();
Local cache
>ObjectCachePerBrokerImpl
protected Map objectTable = null;
public ObjectCachePerBrokerImpl(PersistenceBroker broker) {
objectTable = new HashMap();
// add this cache as permanent listener
broker.addListener(this, true);
}
Cool.
Got to love open source. :)
--Alen
----- Original Message -----
From: "Alen Ribic" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 12:14 PM
Subject: Re: Last cache question from me
> Hi Thomas
>
> You were right there is to be at least one more question. :)
> Where is the impl. class CachePerBrokerImpl?
> Are you referring to ObjectCachePerBrokerImpl? :)
>
> Does global cache mean that the cache is maintained across all broker
> instances
> hence one would need to put more attention towards user transactions?
>
> I'm taking some time to look through the test suite.
>
> thanks
> --Alen
>
>
>
> ----- Original Message -----
> From: "Thomas Mahler" <[EMAIL PROTECTED]>
> To: "OJB Users List" <[EMAIL PROTECTED]>
> Sent: Thursday, June 19, 2003 11:24 AM
> Subject: Re: Last cache question from me
>
>
> > Hi Alen,
> >
> > Alen Ribic wrote:
> > > Hi again
> > >
> > >
> > > 1. What is the major difference between the two below methods of PB?
> > >
> > > removeFromCache(java.lang.Object obj)
> > > invalidate(Identity oid)
> >
> > invalidate has been deprecated some time ago and is mo longer available.
> > so just use removeFromCache.
> >
> > (invalidate was part of the discontinued c/s mode. it's not required to
> > use it any longer)
> >
> > >
> > > 2. Also what is the effect of clearCache() as far as performance is
> concern?
> > >
> >
> > depends a lot on you application. If you perform a lot of lookups the
> > performance gain of a filled cache can be enourmous.
> > This performance gain would be lost if you use clearCache frequently.
> >
> > If your application is not heavily based on lookups, the cache gain
> > won't be so big.
> >
> > the clearCache() call itself can be ignored performancewise.
> >
> > > 3. Do different broker instances communicate in some way especially
when
> it
> > > comes down to caching mechanism?
> >
> > No.
> > Of course certain cache implementations could implement such
> > synchronisation schemes.
> >
> > >
> > > 4. Is there some code snippets that I can look through that show me
the
> > > correct use of removing objects from cache?
> >
> > Yes there are several samples that use these features in the testsuite.
> >
> > I think there is no general answer when a objects should be removed from
> > the cache. It really depends on your application scenario.
> > It also depends on the cache you use. If you run an application serving
> > multiple users and use the CachePerBrokerImpl you won't need a lot of
> > these calls.
> > But if ou are using the DefaultCache (which is global cache) you have to
> > take care a lot about isolating the parallel transactions...
> >
> > I fear this answer will raise some more questions...
> > So maybe this won't be your *last* cache question...
> >
> > ;-)
> >
> > Thomas
> >
> > >
> > >
> > > Thanks in advance
> > >
> > > --Alen
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
>
>
> ---------------------------------------------------------------------
> 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]