All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hazelcast.cache.CacheMergePolicy Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
/*
 * Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
 *
 * 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 com.hazelcast.cache;

import java.io.Serializable;

/**
 * 

* Policy for merging cache entries. *

* *

* Passed {@link CacheEntryView} instances wraps the key and value as their original types * with convertion to object from their storage types. If user doesn't need to original types of key and value, * (s)he should use {@link StorageTypeAwareCacheMergePolicy} which is sub-type of this interface. *

*/ public interface CacheMergePolicy extends Serializable { /** *

* Selects one of the merging and existing cache entries to be merged. *

* *

* Note that as mentioned also in arguments, the {@link CacheEntryView} instance that represents existing cache entry * may be null if there is no existing entry for the specified key in the the {@link CacheEntryView} instance * that represents merging cache entry. *

* * @param cacheName name of the cache * @param mergingEntry {@link CacheEntryView} instance that has cache entry to be merged * @param existingEntry {@link CacheEntryView} instance that has existing cache entry. * This entry may be null if there is no existing cache entry. * @return the selected value for merging */ Object merge(String cacheName, CacheEntryView mergingEntry, CacheEntryView existingEntry); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy