Skip to main content

Caching results

RAW supports caching of execution results. This allows results to be served faster but also helps alleviate load on the source systems where data is read from.

Caching should be used when it is acceptable from a business logic standpoint to serve slightly older results rather than systematically executing the code and reading the freshest data.

To cache results you must set the desired cache expiration in the "Query Result Expiration" under the "Settings" tab when deploying an endpoint. The endpoint results during the first execution. Those results will be valid and reused until the specific cache expiration is reached.

For instance, if you define an endpoint with cache expiration of 10 minutes:

  • The first time it is used, the results are computed and cached;
  • Any requests during the next 10 minutes will return the same exact results. These will be served from the cache and no computation will be performed;
  • Any request after 10 minutes will trigger exactly one recomputation of the results, which will again remain in cache for 10 minutes. If two parallel requests are received, they will be "merged" into a single request as to guarantee a single execution.


For instance, you can deploy the following ISS Location endpoint, which tells you the current location of the International Space Station. After deploying it, remember to set the cache duration to 600 seconds. You will then see that the results will be computed during the first invocation and then reused for 10 minutes, after which they will be recomputed once more when requested.


If you want to try this example, you can deploy the following endpoint, but remember to set the "Query Result Expiration" as discussed above:

ISS location
Obtain the current location of the International Space Station by joining two web services.