Documentation

Cache buildTransfers logo icon


Cache build best praxis

If in your user frontend search times are crucial we recommend to cache at least some information.

Remmenber the basic static data you must cache and update each month in your database:

  • Languages API mapping codes, must be stored (at least the used ones).
  • Destination mapping must be stored, using countries request and for each country get destinations in order to have full HB countries destinations mappings.
  • Currencies mapping must also be stored in case of working with multiple currencies or if you are developing for a platform.
  • IATA airport codes must be stored.
  • Hotel codes (if case of using them).
  • GPS data as accurate as possible, (in case you want to work with GPS but not letting the client input the location data).
  • Routes combinations, so you know all the possible routes combinations we can offer without any request.



See different caching flow examples :

Custom caching can be made, for example lazy cache could be also a valid solution.Depending on needs different caching solutions could be used.

Depending on needs different caching solutions could be used.

We assume basic data (such as countries/destination, IATA , currencies…) has already been imported.




We can split the request of two types :

  • Requests to build cache / cache data
  • LIVE requests on final customer demands.


1. Minimum caching, All with LIVE availabilities :

  • 1. From all the interested destinations, store hotel codes and terminal codes.
  • 2. Let final customer select any combination, then make LIVE avail and display all data from response.
  • 3. Confirm.


For clients that don’t want to cache a lot of data in database.

The bad is that you don’t have any idea if the requested route is available or not either the pricing or content, just codes and names mappings.


2. Full routes caching. All with LIVE availabilities


  • 1. Of the interested/selected destinations, store hotel codes and terminal codes.
  • 2. Of the interested/selected destinations, get all the routes combination until getting all the records.
    Now you can map all possible routes codes combinations we offer (at least one valid contract) and let clients choose from those with more accuracy.
  • 3. Let final customer select any combination, make LIVE avail and display all data from response.
  • 4. Confirm.


For clients that want to have a more accurate availability without having to make any request.

The inconvenience is the update time and size of needed in the DB.


3. Full routes caching. All cached just check and confirm :


  • 1. Of the interested/selected destinations, store hotel codes and terminal codes.
  • 2. Of the interested/selected destinations, get all the routes combination until getting all the records.
    Now you can map all possible routes codes combinations we offer (at least one valid contract) and let clients choose from those with more accuracy.
  • 3. Of the interested ones (or all), for each 100 routes codes (max) make a avail multi request.
  • 4. Let final customer search and provide results from previously cached data.
  • 5. Once final customer has a route selected, send the avail request with precise client time and paxes
    Provide final customer all information from LIVE avail response, as data may have been updated since last cached one.
  • 6. Confirm.


For clients that want to have complete accurate availability and all available content without having to make any request.

The inconvenience is the update time and size of needed in the DB.


Practical flow example:

See an example of how make full cache (we assume you already have basic maping done, as counties, destination, languages...)


1. For each interested destination code (PMI) request basic portfolio:

GET PMI&offset=1&limit=1000

You cache all basic information.


Remenber to get al the records, the response header "X-Total-Count" will the return the total number of records.




2. For each route code up to 100 request multiple avail:

You can request al the returned ones, or just the desired ones.


The response will return all data of each available serviceso you can build the complete cache.

You just need to display cached data to final customers until they are interested in one particular service, then you must make LIVE avail request in order to obtain valid ratekey an updated data, and finally confirmation.