ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Macerot" <g.mace...@omegames.com>
Subject RE: IBATIS map and Cache
Date Thu, 05 Jul 2007 11:44:57 GMT
I try to do the same thing, queries cached by value and in fact the cache do
something (I tried without and it was worth).

 

I have another question: the cache store response data from a query … Then,
if hundred users call this query, the first call store the data in the cache
and the 99 others call the data from the cache or there is one entry for
each user and then the cache is use for the next calls from the same user?
(I’m sorry for my very poor English …. :p)

 

Mohicane

 

  _____  

De : Meindert [mailto:meindert@pastelebusiness.com] 
Envoyé : mercredi 4 juillet 2007 11:22
À : user-java@ibatis.apache.org
Objet : RE: IBATIS map and Cache

 

Maybe try adding readOnly="false" serialize="true" to the cacheModel

 

I had huge issues trying to use queries cached by value (meaning your use of
‘WHERE id=#value#’

) it did not work for me. It didn’t return the right object out of the
read-only cache. Or it didn’t find the object in the cache.

 

Did you check in your logging to see the cache hit or miss?

 

Kind Regards

 

Meindert

 

 

  _____  

From: Niels Beekman [mailto:n.beekman@wis.nl] 
Sent: 04 July 2007 10:19 AM
To: user-java@ibatis.apache.org
Subject: RE: IBATIS map and Cache

 

Did you enable the cache globally in your SqlMap config?

 

  _____  

From: Gabriel Macerot [mailto:g.macerot@omegames.com] 
Sent: woensdag 4 juli 2007 10:17
To: user-java@ibatis.apache.org
Subject: IBATIS map and Cache

 

 

I build a web application. Then I store data in a mysql data base and I use
ibatis in order to map the requests for my application. For optimization I
use LRU cache with the mapping about game_object_template (these objects may
not change a lot).

 

Here is my code :

 

    

    <!-- Modèle de cache -->

    <cacheModel id="GOT.cache" type="LRU">

        <flushInterval hours="1"/>

        <flushOnExecute statement="GameObjectTemplate.insertOne" />

        <flushOnExecute statement="GameObjectTemplate.updateOne" />

        <property name="size" value="750" />

    </cacheModel>

    

    <!-- Getters -->

    <select id="GameObjectTemplate.getOne" resultMap="GOT.map"
cacheModel="GOT.cache">

        SELECT * FROM game_object_templates WHERE id=#value#

    </select>

    

    <select id="GameObjectTemplate.getOneByName" resultMap="GOT.map"
cacheModel="GOT.cache">

        SELECT * FROM game_object_templates WHERE nom=#value#

    </select>

    

    <!-- List -->

    <select id="GameObjectTemplate.getAll" resultMap="GOT.map"
cacheModel="GOT.cache">

        SELECT * FROM game_object_templates got, sous_categories_objets sc,
categories_objets c

        WHERE got.id_sous_categorie = sc.id

        AND sc.id_categorie_objet = c.id

        ORDER BY c.libelle, sc.libelle, got.nom

    </select>

 

I used cache system for other request in my application but it seems here
that nothing works like I want and the request still cost a lot of time.
There is 300 game_object_templates in my data base and one game object got
13 field lots of varchar and some int (if it could help).

 

Is someone could explain me why it doesn’t work or if another solution exist
in order to get these objects (There are often use) ?

 

Mohicane


Mime
View raw message