Does Plivo cache audio files specified in the <Play> XML and Play API?

Plivo caches audio files specified in <Play> XML and Play API based on standard clientside 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 e-tag 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. It will always request your web-server for the resource. Responding with 'Cache-Control:no-cache' will ensure that Plivo will always check to see 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 a returned audio file for a definite period of time. Plivo will consider its cached copy outdated 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 four hours.

The e-tag response header

The e-tag 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 e-tag value of the resource in its cache, allowing your webserver to respond with a new version or with a 304 Not Modified message to instruct Plivo to use its cached version. This enables a more efficient resource update check, 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.

Was this article helpful?
1 out of 1 found this helpful
Didn’t find what you are looking for? Create new ticket