Amazon S3 and Cloudfront cache, how to clear cache or synchronize their cache

后端 未结 9 995
死守一世寂寞
死守一世寂寞 2021-01-30 05:59

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

9条回答
  •  隐瞒了意图╮
    2021-01-30 06:41

    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.

    http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidating-objects-api

    This can also be done using the API! http://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateInvalidation.html

    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's solution doesn't work as setting it to zero is the equivalent of Using the Origin Cache Headers.

提交回复
热议问题