3 Replies Latest reply on Jan 9, 2017 2:04 AM by Galder Zamarreño

    JSR107 Remote cache Hotrod client near caching

    Ben Gardner Newbie

      Please can you tell me how I can configure the jcache remote hotrod client with near caching? It seems only default ConfigurationBuilder is used with properties, and no way to declare nearCache mode.

       

              <dependency>
                  <groupId>org.infinispan</groupId>
                  <artifactId>infinispan-jcache-remote</artifactId>
                  <version>${infinispan.version}</version>
              </dependency>
      

       

              Properties hotrodProps = new Properties();
              hotrodProps.load(Thread.currentThread().getContextClassLoader().getResource("hotrod-client.properties").openStream());
      
              cache = Caching.getCachingProvider("org.infinispan.jcache.remote.JCachingProvider")
                          .getCacheManager(null, null, hotrodProps)
                          .getCache("default");
      

       

      Without JSR107, just using RemoteCacheManager

       

              ConfigurationBuilder unbounded = new ConfigurationBuilder();
      
      
              Properties props = new Properties();
              props.load(Thread.currentThread().getContextClassLoader().getResource("hotrod-client.properties").openStream());
              unbounded.withProperties(props);
              unbounded.nearCache().mode(NearCacheMode.INVALIDATED).maxEntries(-1);
      
      
              RemoteCacheManager remoteCacheManager = new RemoteCacheManager(unbounded.build());
      
      
              remoteWithNearCache = remoteCacheManager.getCache("replcache");