Intelligent Caching is a custom developed feature which benefits all users of the departureboard.io 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 departureboard.io API. The benefits of this are twofold:
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
If the value is
TRUE you can determine the age of the response via the
Age HTTP header.