Plivo caches audio files specified in <Play> XML and Play API based on standard Client-Side Caching directives for RESTful communication over HTTP.

You can control if an audio file should be cached on Plivo servers and for how long should it be cached using the Cache-Control and Etag response headers.

The Cache-Control Response Header

Responding with 'Cache-Control:no-store' will ensure Plivo doesn't maintain a local copy of the file in its cache, and always requests your web-server for the resource.

Responding with 'Cache-Control:no-cache' will ensure Plivo always checks if the file has changed.

Responding with 'Cache-Control: max-age=<new max-age value in seconds>' informs Plivo to use a locally cached copy of the returned audio file for a definite period of time. Plivo will consider its cached copy stale only after the specified number of seconds (max-age value). 

For example: Responding with Cache-Control: max-age=14400 will ensure Plivo directly uses the cached copy for the next 4 hours.

The Etag Response Header

The Etag value of a resource is typically an MD5 hash or some other fingerprint of the contents of the file. 

Plivo sets the If-None-Match request header to the Etag value of the resource in its cache, allowing your web server to respond with a new version or with a 304 Not Modified to instruct Plivo to use its cached version. This enables more efficient resource update checks as no data is transferred if the resource has not changed.

Every Plivo media server maintains its own local cache. Therefore, the first call landing on any Plivo media server will always result in a cache miss.