Hi,
I am using IBatis-3 build 242 (the latest available on the website) and I
find that though I set a cache policy, there is no caching being done by
IBatis. 

In my mapper XML file I have the following line for cache configuration.

<cache eviction="LRU" size="200000" readOnly="true" flushInterval="300000"/>

I have a function getStrategies() as seen below.

    List<Strategy> getStrategies() {
        final SqlSession session = sessionFactory.openSession();
        try {
            final StrategyMapper stratMapper = session.getMapper(
                    StrategyMapper.class);
            return stratMapper.getStrategies();
        } finally {
            if (session != null) {
                session.close();
            }
        }
    }

In my unit tester, I call the getStrategies() method in a loop. For every
call to getStrategies(), I get the following log message when I turned on
DEBUG logging.

2010-04-12 17:06:35,337 [Main Thread] (Log4jImpl.java:27) DEBUG
java.sql.Connection - ooo Connection Opened
2010-04-12 17:06:35,416 [Main Thread] (Log4jImpl.java:27) DEBUG
org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio
[com.aqr.data.refdata.StrategyMapper]: 0.0

2010-04-12 17:06:47,838 [Main Thread] (Log4jImpl.java:27) DEBUG
java.sql.Connection - ooo Connection Opened
2010-04-12 17:06:47,838 [Main Thread] (Log4jImpl.java:27) DEBUG
org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio
[com.aqr.data.refdata.StrategyMapper]: 0.0

I am not sure why caching is not working. Please correct me if I am using
the caching mechanism incorrectly.

Thanks,
Gesly

-- 
View this message in context: 
http://old.nabble.com/Unable-to-get-caching-to-work-with-IBatis---3-%28Build-242%29-tp28219195p28219195.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to