Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2013-2024 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.api;
import org.redisson.api.map.MapLoader;
import org.redisson.api.map.MapWriter;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* Async interface for Redis based implementation
* of {@link java.util.concurrent.ConcurrentMap} and {@link java.util.Map}
*
* This map uses serialized state of key instead of hashCode or equals methods.
* This map doesn't allow to store null as key or value.
*
* @author Nikita Koksharov
*
* @param key
* @param value
*/
public interface RMapAsync extends RExpirableAsync {
/**
* Associates specified key with the given value if key isn't already associated with a value.
* Otherwise, replaces the associated value with the results of the given
* remapping function, or removes if the result is {@code null}.
*
* @param key - map key
* @param value - value to be merged with the existing value
* associated with the key or to be associated with the key,
* if no existing value
* @param remappingFunction - the function is invoked with the existing value to compute new value
* @return new value associated with the specified key or
* {@code null} if no value associated with the key
*/
RFuture mergeAsync(K key, V value, BiFunction super V, ? super V, ? extends V> remappingFunction);
/**
* Computes a new mapping for the specified key and its current mapped value.
*
* @param key - map key
* @param remappingFunction - function to compute a value
* @return the new value associated with the specified key, or {@code null} if none
*/
RFuture computeAsync(K key, BiFunction super K, ? super V, ? extends V> remappingFunction);
/**
* Computes a mapping for the specified key if it's not mapped before.
*
* @param key - map key
* @param mappingFunction - function to compute a value
* @return current or new computed value associated with
* the specified key, or {@code null} if the computed value is null
*/
RFuture computeIfAbsentAsync(K key, Function super K, ? extends V> mappingFunction);
/**
* Computes a mapping for the specified key only if it's already mapped.
*
* @param key - map key
* @param remappingFunction - function to compute a value
* @return the new value associated with the specified key, or null if none
*/
RFuture computeIfPresentAsync(K key, BiFunction super K, ? super V, ? extends V> remappingFunction);
/**
* Loads all map entries to this Redis map using {@link org.redisson.api.map.MapLoader}.
*
* @param replaceExistingValues - true if existed values should be replaced, false otherwise.
* @param parallelism - parallelism level, used to increase speed of process execution
* @return void
*/
RFuture loadAllAsync(boolean replaceExistingValues, int parallelism);
/**
* Loads map entries using {@link org.redisson.api.map.MapLoader} whose keys are listed in defined keys parameter.
*
* @param keys - map keys
* @param replaceExistingValues - true if existed values should be replaced, false otherwise.
* @param parallelism - parallelism level, used to increase speed of process execution
* @return void
*/
RFuture loadAllAsync(Set extends K> keys, boolean replaceExistingValues, int parallelism);
/**
* Returns size of value mapped by key in bytes
*
* @param key - map key
* @return size of value
*/
RFuture valueSizeAsync(K key);
/**
* Returns map slice contained the mappings with defined keys.
*
* If map doesn't contain value/values for specified key/keys and {@link MapLoader} is defined
* then value/values will be loaded in read-through mode.
*
* The returned map is NOT backed by the original map.
*
* @param keys - map keys
* @return Map slice
*/
RFuture