CPaaS CPaaS platform implements a cache strategy for external media resources used for Play and Say verbs, in order to optimize external services access that might incur for those resources such as network traffic, service fees etc.
With the provided cache strategy, CPaaS CPaaS platform will fetch external resources, cache them and reuse them as needed for subsequent invocations.
Cache Strategy explained
When CPaaS CPaaS platform executes Play and Say verbs, for the most of the times, a third party service will be accessed to fetch the media resource (audio WAVE file) to execute, for example:
A Play verb points to a URL for the media resource. CPaaS CPaaS platform will use the provided URL to fetch the media resource (audio WAVE file).
A Say verb configured to use a specific third party Text-To-Speech service provider with certain voice attributes and the text to be transformed to an audio WAVE file. CPaaS CPaaS platform will use the Say verb attributes to fetch the media resource (audio WAVE file).
Given that contents of a Play and Say verbs are mostly static for a CPaaS application, for example most of the announcements in an IVR tree will remain the same for all calls, CPaaS will cache the resulted media resource (audio WAVE file) after the first execution of the verb in order to optimize the consumption of external resources and services.
The cache flow for Play and Say verbs looks like this:
CPaaS CPaaS platform parse Play or Say verb attributes, Play verb contains URL to the media resource and Say verb contains the Voice attributes and Text attributes.
CPaaS CPaaS platform will generate HASH key based on verb content, HASH key will be either the Play verb URL to media resource or the Say verb Voice attributes and Text.
CPaaS CPaaS platform will download external media resource for Play verb, or execute third party API to generate and download media resource for Say verb.
CPaaS CPaaS platform will cache downloaded media resource using the generated HASH as key.
CPaaS CPaaS platform will execute Play or Say verb
For subsequent invocations of Play or Say verb with the same content, CPaaS CPaaS platform will generate a HASH key that matches the key of the already cached resource and will re-use this resource, thus will skip steps 3 and 4 which means it will skip access to external service.