• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009


From [email protected]

As far as I can see, this behaviour in Cache.class

put(Element element, boolean doNotNotifyCacheReplicators)

if (elementExists) { element.updateUpdateStatistics(); } else { applyDefaultsToElementWithoutLifespanSet(element); }



means that the following documentation sample just doesn’t work:


Update an element in a cache. Even though cache.put() is used, ehcache knows there is an existing element, and considers the put an update for the purpose of notifying cache listeners.

Cache cache = manager.getCache(“sampleCache1”); cache.put(new Element(“key1”, “value1”); //This updates the entry for “key1” cache.put(new Element(“key1”, “value2”);

On the first call of put applyDefaultsToElementWithoutLifespanSet will write the ttl and tti values into the element being placed in the cache. On the second call, those values won’t be copied in, but the newly created element will overwrite the old one in the cache. As far as I can see, this means an object has been created that won’t expire. Sourceforge Ticket ID: 1516447 - Opened By: nobody - 3 Jul 2006 16:45 UTC


Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira