VoiceXML Caching

Cache Behaviour

There are several ways that BVR determines whether or not to cache a resource and how long it is considered usable in the cache.

In BVR cache directives are either associated with the resource itself or apply only to an individual request to that resource.

The expiry times displayed by the bam --cache command and stored in the cache's metadata are the expiry times associated with the resource itself. Cache directives supplied on a per-request basis (for example: using the maxage attribute in a goto or audiomaxage in the audio tag) are not stored or displayed for the cached item but are just used to determine whether the cached version of the resource should be used for the current request.

Cache control directives on a resource are hierarchical, the order of preference is as follows:
  • HTTP header values returned by the HTTP server: When a resource is fetched from an HTTP server, it may supply cache directives on the HTTP response in the HTTP Cache-Control header. These are resource associated cache directives.
  • Directives defined in the "http-equiv" meta tag: These override cache directives returned by the HTTP server. These are resource associated cache directives.
  • Individual request directives (for example: using the maxage attribute in a goto or audiomaxage in the audio tag). These are only associated with the current request and are not stored against the resource's metadata in the cache. These directives take precedence over all others.

If no cache control directives are specified for a resource the resource_max_age configuration setting for VXML (VXML Cache Configuration Options) or Audio (AUDIO Cache Configuration Options) will be used as the expiry time and will be stored against the cached entry.

Note that since RFC2616 states that HTTP max-age directives take precedence over the HTTP Expires header, so too does the resource_max_age configuration setting.

‚Äč

Example of Behaviour

Consider the following VoiceXML document:
	<?xml version="1.0" encoding="iso-8859-1"?>
	<vxml xmlns="http://www.w3.org/2001/vxml"
	  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xsi:schemaLocation="http://www.w3.org/2001/vxml
	  http://www.w3.org/TR/voicexml20/vxml.xsd"
	  version="2.0">
	<meta http-equiv="cache-control" content="max-age=60"/>                                               
		<form>
			<block> 
				<audio src="1.wav" maxage="120"/> <!--HTTP server returns Cache-Control: max-age=10 for this resource-->
				<audio src="2.wav"/> <!--HTTP server returns Cache-Control: max-age=10 for this resource-->
				<audio src="3.wav"/> <!--HTTP server returns no Cache-Control headers for this resource-->
			</block>
		</form>
	</vxml>
If the configured resource_max_age for audio is set to 3 minutes, the first call into the application would have the following results:
  • Fetch the VoiceXML document from the HTTP server with a max age of 60 (as this is set in the http-equiv meta tag) and put it in the cache
  • Fetch 1.wav and cache it with a max age of 10 seconds
  • Fetch 2.wav and cache it with a max age of 10 seconds
  • Fetch 3.wav and cache it with a max age of 3 minutes (using the default resource_max_age configuration setting for audio)
Then on another call 20 seconds later:
  • Use the VoiceXML document from the cache as the max age was 60 seconds and this call was made 20 seconds after the one that put the document in the cache
  • Use 1.wav from the cache as, while the HTTP server specified max-age of 10 seconds (which is associated with this resource), the audio tag says that it will accept a resource that is as old as 120 seconds
  • Fetch 2.wav from the HTTP server. The HTTP server specified a max-age of 10 seconds and this has not been overridden
  • Use 3.wav from the cache as the HTTP server did not specify any cache rules and they were not overridden, so the default resource_max_age configuration setting is used.

Further Information

On Cache Management Cache Management Using BAM

On VoiceXML Cache configuration VXML Cache Configuration Options

On Audio Cache configuration AUDIO Cache Configuration Options