CDP:Rename Distribution Pattern
Delivery Without Update Delay
Problem to Be Solved
If you are delivering content using the Cache Distribution Pattern, when a file on the master server is updated, the data on the edge server (the cache server) is not updated until it times out. This cannot handle a case when you want to update a file with a given timing.
Explanation of the Cloud Solution/Pattern
For cache data on an edge server, the URL that accesses that data is used as a key. If there is a file you want to update, you can locate it under a different filename and then change the access URL itself, enabling you to deliver the new content regardless of the cache timeout on the edge server.
- Create base content (such as an HTML file that includes the access URL) separate from the content.
- For the base content, either shorten the cache timeout or always distribute from the master server.
- When updating content distributed by CloudFront, provide that content on the master server, under different names.
- Update the URLs in the base content to the URLs of the new content.
- This lets you deliver new content without waiting for the cache timeout, when content has been updated on the master server.
- Because this would be ineffective if the cache timeout for the base content itself were too long, you should set the cache timeout for the base content to a short value. This reduces the caching effect for the base content, however.
- Because the old file will remain on the edge server until the cache timeout, specifying the URL directly may cause the old file to be downloaded. If necessary, you may delete the old file or use an invalidation function.