-
There is a difference in behaviour between: V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction) as defined in Cache and the equivalent method defined in Map. When the value computed by the function equals the existing value null is returned instead of the existing value. In my specific case the implementation comes via Wildfly 31, and is SimpleCacheImpl. The behaviour in EncodedCache is correct - a value is returned. The issue is that in getUpdatedEntry(), when the oldValue and newValue are the same nothing is set in the CacheEntryChange, presumably the thinking was that nothing is changing so nothing is needed. Unfortunately this means that when notifyAndReturn() executes is finds nothing to return. Q. am i missing something here? it seems a fairly large issue to have not been reported! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This indeed seems to be a bug with the simple cache implementation. I am guessing not many people utilize simple cache with compute returning the same value and checking the returned value. Actually digging more, I think there is another issue where we aren't notifying listeners on the modification as well since a user could technically change the metadata (such as expiration) as well and they aren't notified of that. I have created https://issues.redhat.com/browse/ISPN-15866 to address this. |
Beta Was this translation helpful? Give feedback.
-
thanks for the quick turnaround. this issue has been around since at least Wildfly 26.x, where the cache implementation wrapper was different. guess atomic cache operations aren't as popular as i expected! :) |
Beta Was this translation helpful? Give feedback.
This indeed seems to be a bug with the simple cache implementation. I am guessing not many people utilize simple cache with compute returning the same value and checking the returned value. Actually digging more, I think there is another issue where we aren't notifying listeners on the modification as well since a user could technically change the metadata (such as expiration) as well and they aren't notified of that.
I have created https://issues.redhat.com/browse/ISPN-15866 to address this.