The Key Behavior Cache stores information in the Experience Database (xDB) about a contact's recent activities across all channels in the content delivery environment. The cache is the part of the contact entity that is stored in the shared session state and is read-only.
At the end of an interaction, the Key Behavior Cache is automatically updated to include information about most marketing activities, such as goals triggered, outcomes achieved or campaigns interacted with. Although custom values can be stored in the Key Behavior Cache, these values do not update automatically and require a custom developer solution that must be implemented by the organization.
The Key Behavior Cache cannot be updated by an organization during content delivery. It can only be updated by running the
UpdateKeyBehaviorCache pipeline. This pipeline is called from the
CommitSession pipeline after the session has been submitted.
All Key Behavior Cache data is stored in the Key Behavior Cache collection in xDB. This is partitioned by the contact ID.
You can customize the following Key Behavior Cache settings in the Sitecore.Xdb.Config file:
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.
Specifies the maximum period for interactions that xDB uses during cache rebuilds or updates.
The default value is 30 days.
Specifies the maximum number of interactions that xDB examines during cache rebuilds or updates.
The default value is 25 interactions.
Must be set to true for the Key Behavior Cache to work.
These settings are enabled by default if you have a valid xDB license.
The Key Behavior Cache pipelines
You can use the following pipelines to extend the Key Behavior Cache:
This pipeline performs updates with the latest cached items from the current interaction.
You can also use these processors to extend existing cache logic or update it with your own:
Executing this pipeline loads the Key Behavior Cache data.
Executing this pipeline saves the Key Behavior Cache data.
The Key Behavior Cache methods
The Key Behavior Cache-related methods enable you to extend the
Retrieves read-only cache data.
You can use these methods, for example, to implement some personalization conditions based on information from the Key Behavior Cache.
Loads the Key Behavior Cache for individual contacts.
You can use this to implement personalization for a contact who does not have a current session, then use that information to put them in relevant engagement plan states, for example.