Tdd Apps Blog

Automating Level3 Cache Invalidation

Apr 1, 2016 1 minute read

One of the companies I’ve worked for uses Level3 as their CDN. As part of the release process for one of the products we had to manually clear the CDN cache. This was a manual multi-step process that -more often than not- was forgotten. Automation to the rescue.

The API

Fortunately, Level3 has a REST API with all sort of capabilities. They even provide some Sample Code in a variety of languages. One of this samples is a full-blown debugging tool.

Step 1: Get an API Key

In order to use the Level3 API you must first get an API Key. This needs to be done by an account administrator.

The Application

After ruthlessly copying reviewing the sample code provided by Level3. I was able to create a C# console application to automate the cache invalidation. It receives the following arguments:

All the necessary code is available in GitHub and here’s a rough description of how it works.

Octopus Integration

Octopus is a great tool to automate and manage deployment pipelines. The Level3 Cache Invalidation was crafted with Octopus in mind so that it can be invoked as part of any automated deployment. This Readme file indicates how the code can be used with Octopus.