Amazon S3和的Cloudfront缓存,如何清除缓存或同步其缓存 [英] Amazon S3 and Cloudfront cache, how to clear cache or synchronize their cache
问题描述
我有运行,每10分钟,并更新内容类型和X-AMZ-元cron作业。但由于昨天好像cron任务运行后,亚马逊是不是捡发(刷新自己的高速缓存)的变化。
I have a cron job that runs every 10 minutes and updates the content-type and x-amz-meta. But since yesterday it seems like after the cron job run, Amazon is not picking up the changes made (refreshing his cache).
我还跟并手动进行的更改,但没有改变...
I even went and made the changes manually but no change...
当视频被上传它有一个应用程序/ x-MP4
内容类型和cron作业它更改为视频/ MP4
。
When a video is uploaded it has a application/x-mp4
content-type and the cron job changes it to video/mp4
.
虽然S3具有正确的内容类型视频/ MP4
CloudFront的节目应用程序/ x-MP4
(旧的内容 - 型)....
Although S3 has the right content type video/mp4
cloudfront shows application/x-mp4
(old content-type) ....
在cron作业一直致力于为最近6个月没有问题。
The cron job has been working for the last 6 months without a problem.
什么是错的亚马逊缓存?我怎样才能同步缓存?
What is wrong with amazon caching? How can i synchronize the caching?
推荐答案
使用失效通知,清除缓存,你可以把路径要清除,或者干脆使用通配符来清除所有文件。
Use Invalidations to clear the cache, you can put the path to the files you want to clear, or simply use wild cards to clear everything.
<一个href="http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidating-objects-api">http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidating-objects-api
这也可以做使用API! <一href="http://docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonCloudFront/create_invalidation">http://docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonCloudFront/create_invalidation
This can also be done using the API! http://docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonCloudFront/create_invalidation
在AWS PHP SDK现在有方法,但如果你想使用一些较轻看看这个库: <一href="http://www.subchild.com/2010/09/17/amazon-cloudfront-php-invalidator/">http://www.subchild.com/2010/09/17/amazon-cloudfront-php-invalidator/
The AWS PHP SDK now has the methods but if you want to use something lighter check out this library: http://www.subchild.com/2010/09/17/amazon-cloudfront-php-invalidator/
user3305600的解决方案并没有因为它设置为零的工作就是使用原产地缓存头的等价物。
user3305600's solution doesn't work as setting it to zero is the equivalent of Using the Origin Cache Headers.
这篇关于Amazon S3和的Cloudfront缓存,如何清除缓存或同步其缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!