I'm publishing data from php code to Akamai CDN. I'm looking for a way to clear cache of my data after publish is completed. Can I do it from Akamai user interface? Or should I implement it in my php app?
3 Answers
I think you will have to provide more details here.
1) If you have a 1st level of caching in your server for example a webserver then akamai will understand that there is a change in content and refresh its content automatically once the ttl is expired.
2) If you have set TTL to a high number and want the application to inform akamai about the content update then you can implement this using akamai API's.
3) You this is a not a recurring activity then you can login to Luna portal, navigate to "Publish-> Content Control Utility" and do the cache clear as per your need. It usually takes 30 to 40min for cache removal.
Hope it helps. :)

- 503
- 4
- 8
-
Regarding 3: The CCU API currently takes about 4 minutes to purge in most cases https://community.akamai.com/community/developer/blog/2015/08/19/getting-started-with-the-v2-open-ccu-api?sr=stream – Roman V Jan 12 '16 at 07:46
-
Please ignore the comment above ^^. The cc will be only on static files (images, css, js). TTL indeed will be a high number and most of the purge will be initiated from the CCU control panel or by the API. Regarding 3: I read in CCU documentation that the purge takes about 4 minutes. https://community.akamai.com/community/developer/blog/2015/08/19/getting-started-with-the-v2-open-ccu-api?sr=stream – Roman V Jan 12 '16 at 08:08
-
@RomanV It depends actually. If you want to clear entire cache of a website.(Root directory refresh) then it will take 30-40min. But if its only few URL's then yes approx 4min should do. – Vinod Jan 12 '16 at 13:01
You can use Luna as Vinod mentioned, but it is a tedius manual process.
Your best bet here is to use the Akamai {OPEN} APIs, integrated into your PHP script. I've got a blog post covering this use case at:
There is PHP sample code in the github repository here:
https://www.github.com/akamai-open/api-kickstart
Under examples/php
Kirsten

- 2,681
- 1
- 17
- 20
After few hours of researching and after that I got login credentials to ACCU. This is the snippet that made purge working for me:
$data = array("type" => "arl", "action" => "invalidate", "objects" => array($file));
$data_string = json_encode($data);
$ch = curl_init('https://api.ccu.akamai.com/ccu/v2/queues/default');
curl_setopt($ch, CURLOPT_USERPWD, "aaa:bbb");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
// Send the request & save response to $resp
$resp = curl_exec($ch);
// Close request to clear up some resources
curl_close($ch);
Thanks all for the help and the guidance

- 33
- 1
- 6