Data caching
- Last UpdatedSep 04, 2025
- 2 minute read
When processing an OMF request, the PI Web API authenticates the user identity making the request. In addition to ensuring users only perform authorized actions, the PI Web API also uses the user identity to cache resources. For example, if a request creates an AF Element or writes data to a PI Point, those resources will be cached by the PI Web API and re-used by later requests, improving client application performance.
The PI Web API has two levels of cache: the PI System cache and the OMF cache.
The PI System cache is used by the PI Web API across all endpoints, such as OMF and Core Services. It pools Asset Framework and Data Archive network connections, caches AF resources, and monitors PI System resources for changes. By default, the PI System cache is cleared once every 5 minutes. This cache updates frequently because PI System resources are often modified by applications other than the PI Web API, and so the PI Web API's cached version can quickly fall behind.
The OMF cache is only used by the PI Web API for the OMF endpoint. It caches OMF-specific information like types, containers, and data. By default, this cache is automatically cleared once every 24 hours. This cache updates infrequently because OMF resources are normally only modified by OMF applications through the PI Web API. Because the cache is cleared very infrequently, it can improve client application performance for very long periods of time; however, if there is a manual change to information in PI AF or Data Archive, the cache can easily become out of sync. The best way to avoid this situation is to not make manual changes to data created using OMF - if possible, use an OMF request.
If you need to immediately refresh the PI System or OMF caches and cannot wait for them to automatically refresh, you can include the Cache-Control header when sending a request. The PI Web API supports the max-age and no-cache directives. Be aware that over-use of the Cache-Control header can severely impact performance and increase load on the PI System.
The PI System cache settings can be changed by modifying the PI Web API configuration element. For more information on what settings are available and how to modify them, review Configuration at runtime in the PI Web API User Guide.
The OMF cache settings can be changed by editing the OSIsoft.REST.Host.exe.config file in the PI Web API installation directory. This file includes settings for the type and container caches, as well as several other performance-related settings. Be aware that modifying these settings can negatively impact application performance - the default settings were chosen as a good balance between application performance and PI System load.