3 Replies Latest reply on Jul 22, 2009 11:19 AM by saylor09

    expiration algorithm not working

    saylor09

      Using JBossCache 3.1.0GA, I'm attempting to set expiration times per added node. Based on the documentation, I have thus far:


      DefaultCacheFactory factory = new DefaultCacheFactory();
      Cache cache = factory.createCache();

      Fqn fqn = Fqn.fromString("/streams");
      Node streams = cache.getRoot().addChild(fqn);

      Node child = streams.addChild(Fqn.fromString("/node1"));
      child.put(ExpirationAlgorithmConfig.EXPIRATION_KEY, 100);

      Fqn nf = Fqn.fromString("/streams/node1");
      Thread.currentThread().sleep(2000);
      System.out.println(cache.getNode(nf));

      Thread.currentThread().sleep(2000);
      System.out.println(cache.getNode(nf));
      ....

      The node never gets evicted. Should I expect it to? I've also tried setting the ExpirationAlogrithm in the config:


      ExpirationAlgorithmConfig algorithm = new ExpirationAlgorithmConfig();
      EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(fqn, algorithm);
      cache.getRegion(fqn, true).setEvictionRegionConfig(evictionRegionConfig);


      But this has no effect. I've searched for anything with EXPIRATION_KEY but can't find any other related posts. Does this feature work?

      Thank you,

      Scott