Interface EntryProcessor<K,​V,​R>

    • Method Detail

      • process

        @Nullable
        R process​(MutableCacheEntry<K,​V> entry)
           throws Exception
        Examines or mutates an entry.

        Important: The method must not have any side effects except on the processed entry. For one call to Cache.invoke(K, org.cache2k.processor.EntryProcessor<K, V, R>) the method might be called several times. Some methods of MutableCacheEntry throw exceptions that are consumed by the cache to do asynchronous processing.

        The cache is only modified, if the method completes without exception.

        Parameters:
        entry - the entry to examine or mutate. The reference is only valid within a method call
        Returns:
        a user defined result, that will be passed through and returned
        Throws:
        Exception - an arbitrary exception that will be wrapped into a EntryProcessingException. If an exception happens, the cache content will not be altered.