banner



How To Clear Akamai Cache

Purge Request to Akamai

Purge request to Akamai server is a process to send instruction to the proxy server to free-up some item in the cache so that the new request will get a new copy of data. This is an HTTP command used by Akamai proxy server. Purge cache in Akamai proxy server is very easy, all you need to know is what programming language you use and add the appropriate Web Service.

Akamai Web Service

Language URL
Pearl https://ccuapi.akamai.com/ccuapi.wsdl
Microsoft Visual Basic 6, SOAP 1.0 https://ccuapi.akamai.com/ccuapi-list.wsdl
Microsoft Visual Basic 6, SOAP 3.0 https://ccuapi.akamai.com/ccuapi-list-2001.wsdl
Microsoft Visual Basic .NET https://ccuapi.akamai.com/ccuapi-dotnet.wsdl
Java https://ccuapi.akamai.com/ccuapi-axis.wsdl

Steps to Purge Cache in Akamai Proxy Server in C#

1. Open Microsoft Visual Studio (I am using 2008)

I am going to use C#, so I need to run Visual Studio to create a project and write code to purge cache items:

Image 1

2. Add Akamai Web Service

Akamai is exposing one of their web services that has functionality to trigger purge cache request in Akamai proxy server. All we need to do is to add this service as reference in our .NET application.

Image 2

Right click on the C# project and then click on the Add Service Reference item, then the Add Service Reference popup window will appear.

Image 3

In the Address input box, please input https://ccuapi.akamai.com/ccuapi-dotnet.wsdl and then click on the Go button to load the web service. At the bottom, you'll see Namespace input box you can modify the namespace a sper your convenience, let's say AkamaiPurgeCache. You will be using this namespace upon accessing the methods and classes inside this service.

3. Write Code to Initiate Purge Request to Akamai Proxy Server

Please modify the needed information, especially the credentials and the item you want to purge.

          public          void          PurgeCache()  {          try          {          string          username =          "          username"; 	 					          string          password =          "          password"; 	 					          string          email =          "          mysample@email.com, 	mysample@anotheremail.com";          string[] fileToPurge =          new          string[] 	{"          nstore.abc.com/1234/folder/myfile.html"};  					          string          action =          "          action=remove"; 	          string          domain =          "          domain=production";                                                                string          purgeType =          "          type=arl";                   string[] options =          new          string[]{action, domain, email, purgeType};          AkamaiPurgeCache.PurgeApi purgeAPI =          new          AkamaiPurgeCache.PurgeApiClient();          AkamaiPurgeCache.PurgeResult purgeResult = purgeAPI.purgeRequest 		(username, password,          string.Empty, options, fileToPurge);          if          (purgeResult.resultCode >=          300)          {              System.Text.StringBuilder sb =          new          System.Text.StringBuilder();              sb.AppendFormat("          Error Code: {0}",purgeResult.resultCode);              sb.AppendFormat("          Error Message: {0}", purgeResult.resultMsg);              sb.AppendFormat("          Session ID: {0}", purgeResult.sessionID);              sb.AppendFormat("          URI Index: {0}", purgeResult.uriIndex);          throw          new          Exception(sb.ToString());          }      }          catch(Exception e) {  }

History

  • 23rd April, 2011: Initial version

How To Clear Akamai Cache

Source: https://www.codeproject.com/Articles/186089/How-to-Purge-Cache-in-Akamai-Proxy-Server-using-C

Posted by: blockthowas.blogspot.com

0 Response to "How To Clear Akamai Cache"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel