2 Replies Latest reply on Aug 7, 2006 9:43 PM by z c

    cachelistener configuration

    z c Newbie

      Hi All,
      How to configure the cache listener in the xml configuration file?

      and I tested the POJOCache with 1.4.0.GA use policy and cacheloader like follow

      <attribute name="EvictionPolicyClass">org.jboss.cache.aop.eviction.AopLRUPolicy</attribute>
      
       <!-- Specific eviction policy configurations. This is LRU -->
       <attribute name="EvictionPolicyConfig">
       <config>
       <attribute name="wakeUpIntervalSeconds">5</attribute>
       <!-- Cache wide default -->
       <region name="/_default_">
       <attribute name="maxNodes">5000</attribute>
       <attribute name="timeToLiveSeconds">1000</attribute>
       </region>
       <region name="/test">
       <attribute name="maxNodes">500</attribute>
       <attribute name="timeToLiveSeconds">4</attribute>
       </region>
       </config>
       </attribute>
      
      <attribute name="CacheLoaderConfiguration">
       <config>
       <passivation>true</passivation>
       <preload></preload>
       <shared>false</shared>
      
       <cacheloader>
       <class>org.jboss.cache.loader.jdbm.JdbmCacheLoader</class>
       <properties>
       location=c:/tmp/aop/filetore2
       </properties>
       <async>false</async>
      
       <fetchPersistentState>false</fetchPersistentState>
       <ignoreModifications>false</ignoreModifications>
       <purgeOnStartup>false</purgeOnStartup>
       </cacheloader>
      
       </config>
       </attribute>
      

      then i wrote the following test code
      for(int j = 0; j < 1000; j ++){
       SamplePojo pojo=new SamplePojo(j, "Hany"+(i*1000+j));
       pojo.getHobbies().add("Running");
       pojo.getHobbies().add("Beerathlon");
       pojo.getHobbies().add("Triathlon");
       cache.putObject("/test/"+(j), pojo);
       }
      Thread.sleep(6000);
       System.out.println(tester.cache.getObject(Fqn.fromString("/test/3")));
      
      
      


      the last print will be null, why can not retrieve data from cache?