Şu satırı dahil ederiz
import org.apache.ignite.cache.CacheEntryProcessor;
javax.cache.processor.EntryProcessor arayüzünden kalıtır. Açıklaması şöyle
An entry processor is used to process cache entries on the nodes where they are stored and return the result of the processing. With an entry processor, you do not have to transfer the entire object to perform an operation with it, you can perform the operation remotely and only transfer the results.If an entry processor sets the value for an entry that does not exist, the entry is added to the cache.Entry processors are executed atomically within a lock on the given cache key.
Örnek
Şöyle yaparız
IgniteCache<String, Integer> cache = ignite.cache("mycache"); // Increment the value for a specific key by 1. // The operation will be performed on the node where the key is stored. // Note that if the cache does not contain an entry for the given key, it will // be created. cache.invoke("mykey", (entry, args) -> { Integer val = entry.getValue(); entry.setValue(val == null ? 1 : val + 1); return null; });
Hiç yorum yok:
Yorum Gönder