Search code examples
azurecachingcdncqrsazure-cdn

Cache rest api with Azure CDN


I've just came across this article. It turns out that Fastly's CDN provides support for caching rest api responses. This looks like a perfect solution to relieve your own server and database. Especially if query/command ratio is very high. Basically it works like that:

  1. Command (DELETE / POST / PUT) request has to be handled by your server
  2. After the command completes your API sends a purge request to the CDN
  3. In response to the purge request CND queries you api for new results and caches it
  4. When user queries for a resource the request is handled by the CDN, not bothering your server at all

They provide a configuration interface where you can define caching rules.

Does Azure CDN provide the same kind of functionality? I can't find any information about it on the web.


Solution

  • It seems like the place that this would live would be in the api management service. According to a discussion at the bottom of an article about adding caching to improve api performance they seem to say your scenario isn't possible

    from the discussion:

    "Is it possible to programatically evict something from the cache?"

    -- "Currently this is not supported"