Ok answered my own question: jcs.default.elementattributes.IsEternal=false
-----Original Message----- From: Tim Cronin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 31, 2005 2:21 PM To: JCS Users List Subject: Setting cache timeout on elements I need to be able to set the cache timeout on individual elements. I created a simple function to test with: public void put(Object key, Object value, long ttl) { try { mCache.put(key, value); IElementAttributes iea = mCache.getElementAttributes(key); iea.setMaxLifeSeconds(ttl); System.out.println(mCache.getElementAttributes(key)); } catch (CacheException e) { throw new RuntimeException("Failed add to cache " + key, e); } } Then I'm testing with the following: m.put("key", "value", 30); long time = System.currentTimeMillis(); while (m.get("key") != null) { try { Thread.sleep(500); System.err.print("."); } catch (InterruptedException e) { System.err.println("interupted..."); } } System.out.println(); System.out.println(((System.currentTimeMillis() - time)/1000)); But the loop never exits. Am I doing something wrong? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
