zstan commented on code in PR #6593:
URL: https://github.com/apache/ignite-3/pull/6593#discussion_r2372858677
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/cache/Cache.java:
##########
@@ -73,6 +75,22 @@ public interface Cache<K, V> {
*/
V compute(K key, BiFunction<? super K, ? super V, ? extends V>
remappingFunction);
+ /**
+ * If the value for the specified key is present and non-null, attempts to
compute a new mapping
+ * given the key and its current mapped value.
+ * If the remapping function returns null, the mapping is removed.
+ * If the remapping function itself throws an (unchecked) exception, the
exception is rethrown,
+ * and the current mapping is left unchanged.
+ *
+ * @param key Key with which the specified value is to be associated.
+ * @param remappingFunction The remapping function to compute a value.
+ * @return The new value associated with the specified key, or null if
none.
+ */
+ @Nullable V computeIfPresent(K key, BiFunction<? super K, ? super V, ?
extends V> remappingFunction);
Review Comment:
no need to put the key if it already evicted, pure "compute" can`t give me
such a guarantee
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]