简体   繁体   English

CloudFront与Edge Side包含?

[英]CloudFront with Edge Side Includes?

I've only recently been reading up on the capabilities of Varnish Cache to help optimize my PHP website's performance. 我最近才开始阅读Varnish Cache的功能,以帮助优化我的PHP网站的性能。 I read about a feature called Edge Side Includes, which seems to give me the option to build widgets of html content that can be cached on a component level. 我读到了一个名为Edge Side Includes的功能,它似乎让我可以选择构建可以在组件级别缓存的html内容的小部件。 So that a single page of dynamic content can have parts of the page cached, and other parts not cached. 因此,单页的动态内容可以缓存页面的一部分,而不缓存其他部分。

I then started to look into Amazon CloudFront, which seems to offer page level caching abilities as well. 然后我开始研究Amazon CloudFront,它似乎也提供了页面级缓存功能。 But it isn't clear to me if CloudFront offers the equivalent of Edge Side Includes. 但是,我不清楚CloudFront是否提供相当于Edge Side Includes的功能。 Can someone clarify for me if that is possible? 有人可以为我澄清这是否可能? This would influence the way I architect my PHP website. 这会影响我构建PHP网站的方式。

Unfortunately Cloudfront does not support ESI at this date. 不幸的是,Cloudfront在此日期不支持ESI。

You have three options moving forward. 你有三个选择。

  1. Don't cache content this content in Cloudfront 不要在Cloudfront中缓存此内容的内容

  2. Cache but with a low TTL. 缓存但TTL较低。 Eg cache pages in Cloudfront with a TTL of only 1-20min depending on your application needs. 例如,Cloudfront中的缓存页面的TTL仅为1-20分钟,具体取决于您的应用程序需求。

  3. Implement a backgrund job that invalidates the Cloudfront cache when something is changed. 实施后台作业,在更改内容时使Cloudfront缓存无效。 Beware that Cloudfront have a few limitations on how many concurrent invalidation jobs that can run at the same time. 请注意,Cloudfront对可以同时运行的并发失效作业数量有一些限制。 Ie if your content changes often this might not work. 即如果您的内容经常更改,则可能无效。 Read more about these limits here . 在这里阅读更多关于这些限制

Update You might be able to achieve ESI functionality with Cloudflare and the use of their "Workers" Cloudflare Workers and ESI 更新您可以通过Cloudflare实现ESI功能,并使用他们的“Workers” Cloudflare Workers和ESI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM