Intelligent Caching

Intelligent Caching is a custom developed feature which benefits all users of the API. It provides significantly improved performance for common API calls, and also reduces the amount of calls that are made to National Rail in the background.

Intelligent Caching works by storing the results for API calls for an extremely short period of time (20 seconds). This allows that response to be re-used for other users who are also making the same API call through the API. The benefits of this are twofold:

  • If someone has made the same API request as you within the past 20 seconds, your response will be served from the Intelligent Cache which on average is 5x faster than an uncached response.
  • If your response is served from the Intelligent Cache, your request will not be sent to National Rail. This reduces the amount of National Rail API calls that are made using your API Key. If you are a high volume user this can save you significant money.

A response is only served from Intelligent Cache if someone has requested the exact same data as you within the past 20 seconds.

You can determine if your request was served by the Intelligent Cache by looking for the DBAPI-Served-By-Intelligent-Cache HTTP header. This will be either TRUE or FALSE.

If the value is TRUE you can determine the age of the response via the Age HTTP header.