2 Replies Latest reply on Jun 20, 2012 2:19 AM by robinwyss

    Unable to cache successfully using infinispan and Spring cache abstraction

    venkataratnamteki

      I am trying to do a simple example with spring cache abstraction and infinispan as the cache provider.

      This is the snippet from my springconfig.xml

      <bean id="cacheManager"         class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean">

      <property name="configurationFileLocation" value="classpath:infinispan-config.xml"></property>

      </bean>

      This is the code from my infinispan-config.xml

      <global/> <default> <jmxStatistics enabled="true"/> </default> <namedCache name="books"> </namedCache> 

      Here is my BookDaoImpl code

      @Cacheable(value="books", key="bookId")

      Book findBook(Integer bookId) {

      Here is my main method code

      BookDaoImpl b = (BookDaoImpl) ctx.getBean("bookDao");

      Book b1 = b.findBook(3);


      Thread.sleep(5000);


      Book b2 = b.findBook(3);

      I am seeing findBook method is executed both the times which is not expected.

      Can somebody help me out, what went wrong.!

      Thanks, -Venkat