2 Replies Latest reply on Jul 29, 2013 10:05 AM by Tommy T

    @CachePut not executing

    Tommy T Newbie

      Hi,

       

      I have a method annotated with @CachePut as per below but while the method is getting executed the cache is never updated (Interceptor not getting called). In the snippet below i have left in the manual addition to the cache that I am forced to leave in for now, this manual addition to the same cache works fine (more complete code snippets can be seen here: https://community.jboss.org/thread/230469). The class in question is in a war maven module and the beans.xml has been updated as per below.

       

       

      {code}

      @CachePut(cacheName="user-cache")

                   public void login(@CacheKeyParam String cookieValue, @CacheValue Long userId) {

                      logger.info(" *********** Logging in user into cache map : "+ userId+", "+cookieValue);

       

       

                 //below code staying until i can fgure out why @CachePut is not working

                      logger.info("Manually adding to cache");

                      userCacheMananger.put(cookieValue, userId);

                      logger.info("Post Manual add... cache size is ..."+ userCacheMananger.getNumberOfEntries());

      //

                   }

       

       

      {code}

       

       

      beans.xml

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <!-- This file can be an empty text file (0 bytes) -->

      <!-- We're declaring the schema to save you time if you do have to configure

         this in the future -->

      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="

              http://java.sun.com/xml/ns/javaee

              http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">

       

       

          <interceptors>

              <class>org.infinispan.cdi.interceptor.CacheResultInterceptor</class>

              <class>org.infinispan.cdi.interceptor.CachePutInterceptor</class>

              <class>org.infinispan.cdi.interceptor.CacheRemoveEntryInterceptor</class>

              <class>org.infinispan.cdi.interceptor.CacheRemoveAllInterceptor</class>

          </interceptors>

       

       

      </beans>


      {code:xml}



      Am i forgetting something else?


      JBoss: 7.1

      Infinispan:  5.1.0.FINAL


      Thanks

      T