# Key behavior cache

Abstract

An overview of the key behavior cache facet's configuration options and calculation logic.

### Note

The KeyBehaviorCache class will be undeprecated in an upcoming release. You can use this class even though it is currently marked as obsolete.

The key behavior cache is a calculated facet that stores information about a contact’s most recently triggered events. The key behavior cache facet is represented by the Sitecore.XConnect.Collection.Model.KeyBehaviorCache class.

## Calculation logic

The following table describes where the data each list of Sitecore.XConnect.Collection.Model.KeyBehaviorCacheEntry comes from:

Property

Calculation logic

Campaigns

Taken from interaction’s Events property where event is of type CampaignEvent, and from the interaction’s CampaignId property.

Goals

Taken from interaction’s Events property where event is of type Goal.

Channels

Taken from the interaction’s ChannelId property.

Outcomes

Taken from interaction’s Events property where event is of type Outcome.

PageEvents

Taken from interaction’s Events property where the ParentEventId is the ID of a PageEvent, and the event is not an Outcome or Goal.

Venues

Taken from the interaction’s VenueId property.

CustomValues

Not currently set.

Entries are trimmed from each list if:

• The associated interaction falls outside the configured maximum time period (for example, 30 days)

• The maximum number of list cache entries has been exceeded - the oldest cache entries are trimmed

• The number of unique interactions represented by all cache entries exceeds the maximum - the oldest cache entries are trimmed

### Note

If the maximum interaction count is 25 and each cache entry is represented by a unique interaction, the list is limited to 25 entries even if the maximum cache entry count is 50.

## Configuring the key behavior cache

The following configuration options are defined in two locations in the \App_data\config\sitecore\Collection\sc.XConnect.Collection.Model.Plugins.xml. You must update the configuration values in both locations:

• <IContactMergeHandler.KeyBehaviorCacheHandler>

• <ICalculatedFacetHandler.KeyBehaviorCacheHandler>

Element

Description

MaximumCacheEntryCount

Specifies the maximum number of items in the cache for a given category, such as goals, page events, and so on.

The default value is 50 entries.

MaximumInteractionPeriod

Specifies the maximum period for interactions that xDB uses during cache rebuilds or updates.

The default value is 30 days.

MaximumInteractionCount

Specifies the maximum number of interactions that xDB examines during cache rebuilds or updates.

The default value is 25 interactions.