Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Web API

Cache management

  • Last UpdatedMar 24, 2025
  • 1 minute read

PI Web API is built on top of AF SDK, which is designed to be run within the context of a single user. To support multiple simultaneous users, PI Web API hosts multiple instances of AF SDK. These instances of AF SDK are provisioned automatically by PI Web API. Advanced users might need to understand the mechanisms by which caching occurs.

Cache mechanism

PI Web API allocates a separate cache to each user. Caches are marked for refresh at five-minute intervals. After the five-minute interval has elapsed, or if an appropriate Cache-Control header is sent with the request, the cache is refreshed during the first request that is served by the cache.

Each cache can serve multiple concurrent read requests. In addition, requests to write time-series data to resources under the /piwebapi/streams hierarchy execute concurrently with read requests, because no locking is required to fulfill such writes.

With the exception of writes to resources under the /piwebapi/streams hierarchy, simultaneous requests to write data to the PI System require exclusive access to the cache, which means that all concurrent read and write requests are queued.

Caches expire if they have not been used for longer than 15 minutes after their most recent refresh. This frees the memory associated with the cache for use by other caches within PI Web API, or for other processes on the system.

Refreshing the cache requires exclusive access to the cache instance. While the cache is refreshing, all requests to read or write from the cache are queued.

Note: Refreshes of AF cache are resource-intensive and should be used with care.

TitleResults for “How to create a CRG?”Also Available in