---
title: "Reference data caching"
slug: "reference-data-caching"
abstract: "Overview of the settings involved in the caching of reference data."
---
# Reference data caching

Caching is controlled by the following section of the `C:\path\to\reference\data\App_data\config\sitecore\ReferenceData\sc.XConnect.ReferenceData.Service.Cache.xml` file:

```xml
<ReferenceData.Service.Cache.MemoryDefinitionCache>
       <!-- Cache implementation which stores entries in memory. -->
       <Type>Sitecore.Xdb.ReferenceData.Service.Cache.MemoryDefinitionCache, Sitecore.Xdb.ReferenceData.Service</Type>
       <As>Sitecore.Xdb.ReferenceData.Core.Cache.IDefinitionCache, Sitecore.Xdb.ReferenceData.Core</As>
       <LifeTime>Singleton</LifeTime>
       <Options>
       <!-- The lifetime of entries in the cache. Default value: 20 seconds. -->
       <EntryLifetime>`00:00`:20</EntryLifetime>
       </Options>
   </ReferenceData.Service.Cache.MemoryDefinitionCache>

These settings apply if you are using accessing the Reference Data Service over HTTPS using the :code:`ReferenceDataHttpClient` implementation of :code:`IReferenceDataClient`. To disable caching, replace the cache type with :code:`NullDefinitionCache`:
<ReferenceData.Service.Cache.MemoryDefinitionCache>
    <!-- Cache implementation which stores entries in memory. -->
    <Type>Sitecore.Xdb.ReferenceData.Service.Cache.NullDefinitionCache, Sitecore.Xdb.ReferenceData.Service</Type>
    <As>Sitecore.Xdb.ReferenceData.Core.Cache.IDefinitionCache, Sitecore.Xdb.ReferenceData.Core</As>
    <LifeTime>Singleton</LifeTime>
</ReferenceData.Service.Cache.MemoryDefinitionCache>

```

> [!note]
> If you are accessing the Reference Data Service from a Sitecore server that uses the `ReferenceDataService` implementation of `IReferenceDataClient`, [caching client configuration](https://doc.sitecore.com/xp/en/developers/93/platform-administration-and-architecture/en/configure-the-tracker-s-reference-data-client-api-timeout.html) applies.

## Configuring the Reference Data Service in a Sitecore context

Some core roles, such as Processing, access the Reference Data Service database directly via the [service API](https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-platform/reference-data-service-api.html "Reference Data Service API") rather than the client API. In a Sitecore context, the Reference Data Service caching options are configured in the C:\\path\\to\\sitecore\\App_Config\\Sitecore\\Marketing.Xdb.ReferenceData.Service\\Sitecore.Xdb.ReferenceData.Service.config file.

The following settings determine the cache implementation and cache entry lifetime:

```xml
<xdb.referenceData.service>
  <definitionCache type="Sitecore.Xdb.ReferenceData.Service.Cache.MemoryDefinitionCache, Sitecore.Xdb.ReferenceData.Service">
    <!-- entryLifetime: The lifetime of entries in the cache, given as a TimeSpan -->
    <param name="entryLifetime">`00:00`:30</param>
  </definitionCache>
</xdb.referenceData.service>

```

To disable caching, replace the cache type with `NullDefinitionCache` as shown:

```xml
<xdb.referenceData.service>
  <definitionCache type="Sitecore.Xdb.ReferenceData.Service.Cache.NullDefinitionCache, Sitecore.Xdb.ReferenceData.Service">
    <!-- entryLifetime: The lifetime of entries in the cache, given as a TimeSpan -->
    <param name="entryLifetime">`00:00`:30</param>
  </definitionCache>
</xdb.referenceData.service>

```