com.hazelcast.cache.merge

## Class HigherHitsCacheMergePolicy

- java.lang.Object
- - com.hazelcast.cache.merge.HigherHitsCacheMergePolicy

- All Implemented Interfaces:
    CacheMergePolicy, StorageTypeAwareCacheMergePolicy, Serializable

      public class HigherHitsCacheMergePolicy
      extends Object
      implements StorageTypeAwareCacheMergePolicy

  Merges cache entries from source to destination cache if the source entry has more hits than the destination one.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HigherHitsCacheMergePolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `merge(String cacheName, CacheEntryView mergingEntry, CacheEntryView existingEntry)` Selects one of the merging and existing cache entries to be merged.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HigherHitsCacheMergePolicy

          public HigherHitsCacheMergePolicy()

  - ### Method Detail

    - #### merge

          public Object merge(String cacheName,
                              CacheEntryView mergingEntry,
                              CacheEntryView existingEntry)

      Description copied from interface: `CacheMergePolicy`
      Selects one of the merging and existing cache entries to be merged.

      Note that the `existingEntry` may be `null` if there is no entry with the same key in the destination cache. This happens, when the entry for that key was

      - only created in the smaller sub-cluster during the split-brain
      - removed in the larger sub-cluster during the split-brain
      Specified by:
        `merge` in interface `CacheMergePolicy`
      Parameters:
        `cacheName` - name of the cache
        `mergingEntry` - `CacheEntryView` instance that has the cache entry to be merged
        `existingEntry` - `CacheEntryView` instance that has the existing cache entry or `null` if there is no existing cache entry
      Returns:
        the selected value for merging or `null` if the entry should be removed

Copyright © 2019. All rights reserved.