phpcachingakamai

Akamai clear cache after publishing


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?


Solution

  • 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