How can I update AKAMAI automatically after publishing content in Tridion 2011?
Is a Storage extension the only or are there any simple ways to do this?
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.Sign up to join this community
The ideal situation is to try to avoid having to invalidate items in Akamai and instead just rely on the normal expiration rules you have setup in your Akamai configuration to take care of content refresh.
For example, if you have static content that is going to change frequently, consider publishing it to a folder you can use as the basis of a customized rule in the Time to Live Rules section of your Akamai and assign a short TTL to files in that path:
If there are files you need to do this for and your origin servers are windows servers, one alternative is to setup a windows service to watch for Directory Change Notifications. When it reports a file modification or deletion convert the file name/path a URL and use the Content Control Utility Soap API (Akamai Login Required) in Akamai to invalidate the file.
This is potentialy a much more complex alternative then writing a storage extension however I am mentioning it because there may be situations where it is more appropriate.
For instance if you are using a dynamic image resizer such as ImageResizer you may need to have the act of publishing a modified binary file from Tridion trigger an invalidation of not just the published binary but also any of the variants of the original file created by ImageResizer so some more complex logic might be involved.
Or if you have multiple ways potentially 'modified' content is arriving on your origin servers including (some which do not involve content published from Tridion) you'll have to go outside of a storage extension.
One important thing to note is that the CCUAPI is limited in how many changes you can submit at one time:
One limit is that files submitted for CCU requests should contain no more than about 100 URLs of about 400 characters in length. If you receive a “Request Entity Too Large” error, split your file into smaller files and try again.
You can submit any number of files containing about 100 URLs, but you should have no more than 10,000 outstanding requests at any one time. If you receive a code 332 error, which indicates you have exceeded that limit, you should wait about 10 minutes and try again.
And a final important thing to note: invalidating (or even purging) an item from Akamai does not guarentee end users of your site will see the updated content. If there browser already has the piece of content cached their client will obey whatever caching instructions were originally sent with the content.
12/05/2017 Edit: Just had someone recently up vote this answer so I did want to mention Akamai has updated their CCU API to Version 3.0 and the API now leverages their Fast Purge API.
The best way to integrate with Akamai (or most CDNs in general) is to do absolutely nothing, and let Akamai crawl your "origin" servers on a regular basis.
If you really need the type of control that you seem to think you need, then a storage extension is the way to go. You could work on a deployer extension too, but then you'll have to deal with unpublishing of binaries (not easy to do on deployer extensions) and the transactional aspects of a deployment (what happens if a later module fails?).
Rogier Oudshoorn's answer recommends looking into setting cache-expiration policy via headers that are set by your applications. That is absolutely the way to go for day-to-day operation of content expiration.
However, there are times when you really need to expire something more programmatically. For example, an item that is referenced from a home page gets a title change. You want that change to show up on the home page, but the header for the home page is a different cache time that the item you edited.
So, you need to be able, occasionally, to tell akamai to clear the cache on an item based on rules in your application, rather than just set policy for items.
For this, you'll need to use akamai's API.
You'll find what you need here:
CCU REST API Developers Guide The CCU REST API provides a programmatic interface for developers.
Prerequisites To use the CCU REST API effectively, you must be familiar with your Akamai content model and the ARLs, URLs, and CP codes used to identify your content. Beyond that, the CCU REST API is a simple API for automating content purge requests.
The REST api is fairly new and, if your needs are straightforward, is much more simple to implement that using the SOAP api.
I would advise you to look into setting HTTP response headers to tell Akamai how long to cache a particular page; the application can probably do a very decent "guess" on what a proper refresh time is for a page. If you can set a good cache-expectation here, you may not need to invalidate anything.