• Bug
  • Status: Open
  • 2 Major
  • Resolution:
  • ehcache
  • jhouse
  • Reporter: robzilla
  • October 12, 2012
  • 0
  • Watchers: 5
  • November 19, 2012

Description

Calls to putAll(Collection) will always result in notifyElementPut notifications, never notifyElementUpdate. Is there a logical reason for this behavior (it creates problems in our app) or is this a bug?

[code]… compoundStore.putAll(elements); for (Element element : elements) { element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false); }

private void notifyPutInternalListeners(Element element, boolean doNotNotifyCacheReplicators, boolean elementExists) {
    if (elementExists) {
        registeredEventListeners.notifyElementUpdated(element, doNotNotifyCacheReplicators);
    } else {
        registeredEventListeners.notifyElementPut(element, doNotNotifyCacheReplicators);
    }
}[/code]

We’d like to get update notifications for elements that already exist in the cache.

Comments

Fiona OShea 2012-10-12

IS this “as designed” and therefor a feature request? Or a bug?

James House 2012-10-12

This is as-designed.

There would be significant performance impact with doing all the lookups to see if they are pre-existing (particularly with clustered caches).

If you have a small set of data or are otherwise willing to live with the lookup costs, you could easily build your own putall method that does the lookups and determines which event to use.

Saravanan Subbiah 2012-10-12

When we do the new event notification system with the ability to register interest for specific events, we will be able to selectively send updates to those who are interested. That will greatly help as users will pay penalty only when really need the feature. Today its not set up in that way.