Azure API Management, Caching

Alberto De Natale
2 min readAug 1, 2019

--

Caching is one of the features added by Azure API Management.

If for example, your traffic was regularly presenting you with the same requests and serving them required money, you would have found a valid use case for setting caching up.

Without caching

I have a pre-configured Azure Api Management set up on my account that calls an Azure Function.

Normally this is the chain of events that takes place when I call the “GenerateRandomJobSheet” method

  1. An HTTP Request is sent

2. The function is run

3. The result is returned

Adding Caching

I will go to the inbound policies and I will click “Add Policy”

I will click on “Cache Responses”:

I take the default configuration and set the duration to be 120s:

With Caching

The response now looks as follows:

These headers are instructing the browser not to cache the response.

The function has been called:

Subsequent requests, however, won’t trigger the function and will return the same result.

Summary

Caching is easy to implement using Azure API Management and could really save plenty of coding hours.

--

--

Alberto De Natale
Alberto De Natale

Written by Alberto De Natale

Alberto De Natale is a passionate tech-enthusiast software developer.

No responses yet