Show / Hide Table of Contents

# Namespace Apache.Ignite.Core.Cache.Affinity

### Classes

#### AffinityFunctionBase

Base class for predefined affinity functions.

#### AffinityFunctionContext

Affinity function context.

#### AffinityKeyMappedAttribute

Specifies cache key field to be used to determine a node on which given cache key will be stored. Only one field or property can be marked with this attribute.

This attribute is an alternative to AffinityKeyFieldName setting. This attribute has lower priority than AffinityKeyFieldName setting.

One of the major use cases for this attribute is the routing of grid computations to the nodes where the data for this computation is cached, the concept otherwise known as Colocation Of Computations And Data.

For example, if a Person object is always accessed together with a Company object for which this person is an employee, then for better performance and scalability it makes sense to colocate Person objects together with their Company object when storing them in cache. To achieve that, cache key used to cache Person objects should have a field or property marked with AffinityKeyMappedAttribute attribute, which will provide the value of the company key for which that person works.

### Structs

#### AffinityKey

Optional wrapper for cache keys to provide support for custom affinity mapping. The value returned by Affinity will be used for key-to-node affinity.

#### AffinityTopologyVersion

Affinity topology version.

### Interfaces

#### IAffinityFunction

Represents a function that maps cache keys to cluster nodes.

Predefined implementations: RendezvousAffinityFunction.