ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron Grabowski (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-182) Add global cache declaration
Date Tue, 16 Aug 2005 15:42:54 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-182?page=comments#action_12318904 ] 

Ron Grabowski commented on IBATIS-182:

I understand what you're asking for now. That would certainly make the cacheModel nodes shorter.
This sounds similiar to Struts' support of wildcards in the struts.config file. 

You'd have to be careful with this notation though. If you had 50+ sqlMap files and they all
used the same GlobalCache, it may be awkward to try and tweak the cache settings later on
because you'd be affecting all the maps in your project. 

Even with a lot of sqlMaps, I think its safer to have each statement have its own cacheModel...or
at least partition the GlobalCache into big groups somehow.

A more flexiable approach may be to delegate this functionality to a custom cacheModel:

<sqlMap namespace="CacheModels">
   <cacheModel id="GlobalCache" implementation="Company.Project.IBatis.Cache.GlobalCache">
    <property name="internalImplementation" value="LRU" />
    <property name="logCacheHits" value="true" />
    <property name="flushInterval" value="2" />
    <property name="flushOnExecute" value="*.Insert" />

I don't know what all would need to be changed in the Java version, but on the .Net side of
things I think the Configure method of the ICacheController interface would need a ConfigurationScope
object passed in:

 void Configure(IDictionary properties, ConfigurationScope configScope)

> Add global cache declaration
> ----------------------------
>          Key: IBATIS-182
>          URL: http://issues.apache.org/jira/browse/IBATIS-182
>      Project: iBatis for Java
>         Type: New Feature
>   Components: SQL Maps
>     Versions: 2.2.0, 2.2.5
>  Environment: All
>     Reporter: agharta

> Can i suggest a new feature??
> I suggest a global cache declaration, available for many sqlmap files.
> Example:
> Now,  into a sqlMap file:
> <cacheModel id="cache" readOnly="true" serialize="true" type="LRU">
>         <flushOnExecute statement="Author.insertAuthor"/>
>         <flushOnExecute statement="Author.updateAuthorById"/>
>         <flushOnExecute statement="Author.deleteAuthorById"/>
>         <property name="size" value="100000"/>
>         <flushInterval hours="24"/>
> </cacheModel>  
> Ok? This cache is valid only into this sqlmap file.
> So, following Spring's idea, if i have many sqlmap files and i want to extend the same
cache declaration....
> //into sqlMapConfig file or another dedicated file
> <cacheMap namespace="GlobalCache"> //new definition
>     <cacheModel id="cache" readOnly="true" serialize="true" type="LRU">
>         <flushOnExecute statement="insert*"/>
>         <flushOnExecute statement="update*"/>
>         <flushOnExecute statement="delete*"/>
>         <property name="size" value="100000"/>
>         <flushInterval hours="24"/>
>     </cacheModel>  
> </cacheMap>
> So, the sqlMap call the global cache model with the  useStatementNamespaces="true" setted
into sqlmapconfig file (therefore many global cache are availables)
> <statement id="getAuthorById" parameterClass="java.lang.Integer"
>         resultMap="get-author-result" cacheModel="GlobalCache.cache" >
>         <include refid="select"/>
>         WHERE ID = #value#
>  </statement>
> With this feature we'll save a lot of redundant code.
> I suggest a cache definition also into insert/update/delete statements, to allow the
internal or "global" cache selection.
> Is it possible??
> Thanks a lot for reply!
> Regards,
>                       Agharta

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message