1 Reply Latest reply on Jul 26, 2016 8:41 AM by Paul Ferraro

    Infinispan disable data loading on startup

    Fatih isik Newbie

      I am trying to use infinispan for clustered data synchronization. But i don't need persistence to a file and load data on startup.

      i set preload to false but after restarting server , i retrieved previously added data.

       

      Firstly, How can i programmatically disable loading on startup.

       

       

      Cache<String, String> cache = null;

        

        @PostConstruct

        public void postConstruct(){

             ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

             configurationBuilder.persistence().passivation(false).addSingleFileStore().preload(false).clustering().cacheMode(CacheMode.REPL_ASYNC);

        

             Configuration configuration = configurationBuilder.build();

             DefaultCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().transport().defaultTransport().build(), configuration);

        

             String newCacheName = "repl";

             cacheManager.defineConfiguration(newCacheName, configuration);

             cache = cacheManager.<String, String>getCache(newCacheName);

        }

       

        

        public String putDate(){

             Date date = new Date();

             cache.put("date", date.toString());

             return date.toString();

        }

        

        public String getDate(){

             return cache.get("date");

        }