Skip to content

Latest commit

 

History

History
 
 

cache-api-old

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Cache-API microservice

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 in X seconds (default is 60 seconds in src/server.js, see .env_examples for the needed ENV VARS), the key will be removed altogether from cache-api.
  • Any successful non-empty queries from data-api will automatically save to the cache-api as well