0 Replies Latest reply on Jan 23, 2010 5:23 PM by citress

    Using ExpirationAlgorithm with PojoCache

      I am trying to configure an eviction policy using the ExpriationAlgorithm for my PojoCache, and I would like to specify a time-to-live value for each pojo I insert into the cache. The only documentation I found says to do this:

       

         Cache cache = DefaultCacheFactory.createCache();
         Fqn fqn1 = Fqn.fromString("/node/1");
         Long future = new Long(System.currentTimeMillis() + 2000);
      
         // sets the expiry time for a node
         cache.getRoot().addChild(fqn1).put(ExpirationConfiguration.EXPIRATION_KEY, future);
      

       

      However, since I am using a PojoCache, I have to retrieve the underlying generic cache (through getCache()) in order to object the generic Cache in order to call .getRoot().addChild(...).put(....). The documentation for getCache() says only to use this for non-POJO cache operations.

       

      Can I use ExpirationAlogrithm wtih PojoCache, and if so, how do I configure the time-to-live for each pojo I'm inserting into the cache?

       

      Thanks!