ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Henrique Ferreira e Silva <dhsi...@gmail.com>
Subject Re: RV: Problems with the cache
Date Tue, 12 Jul 2005 13:15:47 GMT
Hi Juan,

For instance:

queryForObject("consultaFormulario_PE016", "x");
queryForObject("consultaFormulario_PE016", "y");
queryForObject("consultaFormulario_PE016", "z");

In this situation, all the three statements will cause a database hit.
But in the situation below:

queryForObject("consultaFormulario_PE016", "x");
queryForObject("consultaFormulario_PE016", "y");
queryForObject("consultaFormulario_PE016", "y");

we'll have 2 database hits. When the statement gets executed with the
parameter "y" for the second time, it'll fetch it from the cache.

So, is your app repeating in any moment a call to that statement with
same parameter value? If so, it _must_ be fetching it from the cache.

Can you write a simple test using these two scenarios i showed and see
what is going on?
Does the second scenario still have 3 database hits in your tests?

Tell us what you find out.

Cheers,
Daniel Silva.







On 7/12/05, Barrena Legorburu, Juan <jbarrena@iberdrola.es> wrote:
> 
> No, when I call the statement, it always hits the database.
> I use an Oracle database and I am monitoring it, so I know if it hits the
> database or not.
> I think that this configuration is OK, but I cannot use the cache.
> Can you help me?
> 
> -----Mensaje original-----
> De: Daniel Henrique Ferreira e Silva [mailto:dhsilva@gmail.com]
> Enviado el: lunes, 11 de julio de 2005 15:10
> Para: user-java@ibatis.apache.org
> Asunto: Re: RV: Problems with the cache
> 
> 
> Hi Juan,
> 
> What are you trying to do?
> Your configurations seem to be OK for me. Looking at your SQL statement, it
> seems for me that you're retrieving records from your table using the
> primary key. So, when you call that statement, if you don't use the same
> value at least twice, it'll always hit the database to fetch the data you
> want. Is that your current situation?
> 
> HTH,
> Daniel Silva.
> 
> On 7/11/05, Barrena Legorburu, Juan <jbarrena@iberdrola.es> wrote:
> >
> >
> > ¿How can I use the cache?
> > I don´t know why the cache is not running............
> >
> >
> >  I have in sql-map-config.xml
> >
> >
> > <settings
> >
> > cacheModelsEnabled="true"
> >
> > enhancementEnabled="true"
> >
> > lazyLoadingEnabled="true"
> >
> > maxRequests="32"
> >
> > maxSessions="10"
> >
> > maxTransactions="5"
> >
> > useStatementNamespaces="false"
> >
> > />
> >
> > and I have in the sql file:
> >
> >
> >
> > <cacheModel id="cache_consultaFormulario_PE016" type="LRU">
> >
> > <flushInterval hours="24"/>
> >
> > <property name="size" value="10000" />
> >
> > </cacheModel>
> >
> >
> >
> > <select cacheModel="cache_consultaFormulario_PE016"
> > id="consultaFormulario_PE016" parameterClass="string"
> > resultClass="com.iberdrola.wps.portlet.formularios.entidad.bd.Epe016fr
> > mFormularios">
> >
> > SELECT PE016_ACTIVADO FROM PE016_FRM_FORMULARIOS where PE016_ID =
> > #value#
> >
> > </select>
> >
> >
> >
> >  =============================
> >  Este mensaje se dirige exclusivamente a su destinatario.  Puede
> > contener informacion confidencial sometida a secreto profesional o
> > cuya divulgacion  este prohibida, en virtud de la legislacion vigente.
> > No esta permitida su divulgacion,
> >  copia o distribucion a terceros sin la autorizacion previa y por escrito
> de
> > Iberdrola.
> >  Si ha recibido este mensaje por error, le rogamos nos lo comunique
> > inmediatamente
> >  por esta misma via y proceda a su destruccion.
> >
> >  This e-mail is intended exclusively for the individual or entity to
> > which it is addressed  and may contain confidential or legally
> > privileged information, which may not be disclosed
> >  under current legislation. Any form of disclosure, copying or
> distribution
> > of this e-mail
> >  is strictly prohibited, save with written authorisation from Iberdrola.
> >  If you have received this message in error, please notify the sender
> > immediately by e-mail
> >  and delete all copies of the message.
> >  =============================
> >
> 
> 
> 
> 
> =============================
> Este mensaje se dirige exclusivamente a su destinatario.
> Puede contener informacion confidencial sometida a secreto profesional o cuya divulgacion
> este prohibida, en virtud de la legislacion vigente. No esta permitida su divulgacion,
> copia o distribucion a terceros sin la autorizacion previa y por escrito de Iberdrola.
> Si ha recibido este mensaje por error, le rogamos nos lo comunique inmediatamente
> por esta misma via y proceda a su destruccion.
> 
> This e-mail is intended exclusively for the individual or entity to which it is addressed
> and may contain confidential or legally privileged information, which may not be disclosed
> under current legislation. Any form of disclosure, copying or distribution of this e-mail
> is strictly prohibited, save with written authorisation from Iberdrola.
> If you have received this message in error, please notify the sender immediately by e-mail
> and delete all copies of the message.
> =============================
>

Mime
View raw message