Package org.apache.ignite.cache.affinity

## Interface AffinityKeyMapper

- All Superinterfaces:
    `Serializable`

      @Deprecated
      public interface AffinityKeyMapper
      extends Serializable

  Deprecated.
  Use `AffinityKeyMapped` or `CacheKeyConfiguration.setAffinityKeyFieldName(String)` instead.
  Affinity mapper which maps cache key to an affinity key. Affinity key is a key which will be used to determine a node on which this key will be cached. Every cache key will first be passed through `affinityKey(Object)` method, and the returned value of this method will be given to `AffinityFunction` implementation to find out key-to-node affinity.

  The default implementation, which will be used if no explicit affinity mapper is specified in cache configuration, will first look for any field or method annotated with `@AffinityKeyMapped` annotation. If such field or method is not found, then the cache key itself will be returned from `affinityKey(Object)` method (this means that all objects with the same cache key will always be routed to the same node). If such field or method is found, then the value of this field or method will be returned from `affinityKey(Object)` method. This allows to specify alternate affinity key, other than the cache key itself, whenever needed.

  A custom (other than default) affinity mapper can be provided via `CacheConfiguration.getAffinityMapper()` configuration property.

  For more information on affinity mapping and examples refer to `AffinityFunction` and `@AffinityKeyMapped` documentation.

  See Also:
    `AffinityFunction`, `AffinityKeyMapped`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Object` | `affinityKey​(Object key)` | Deprecated. Maps passed in key to an alternate key which will be used for node affinity.
    `void` | `reset()` | Deprecated. Resets cache affinity mapper to its initial state.

- - ### Method Detail

    - #### affinityKey

          Object affinityKey​(Object key)

      Deprecated.
      Maps passed in key to an alternate key which will be used for node affinity.
      Parameters:
        `key` - Key to map.
      Returns:
        Key to be used for node-to-affinity mapping (may be the same key as passed in).

    - #### reset

          void reset()

      Deprecated.
      Resets cache affinity mapper to its initial state. This method will be called by the system any time the affinity mapper has been sent to remote node where it has to be reinitialized. If your implementation of affinity mapper has no initialization logic, leave this method empty.