This API is responsible for querying the in memory key-value data store (Redis). If data is found, it will be returned to the client (e.g. flight-api
). The flight-api
always queries cache-api
first, and only queries data-api
if no results are found in the cache.
Data is queried via a RESTful path and is subsequently stored into cache using the RESTful url path as the key. For example:
# Given the following URL request for data:
http://domain.name/flights/country/can
# the path will be
/flights/country/can
# the key used in the cache will also be
/flights/country/can
NOTE:
- There is a Time To Live (TTL) for the cache. If the
cache-api
has not been accessed inX
seconds (default is 60 seconds insrc/server.js
, see .env_examples for the needed ENV VARS), the key will be removed altogether fromcache-api
. - Any successful non-empty queries from
data-api
will automatically save to thecache-api
as well