如何在 cakephp 3 中缓存视图

how to cache view in cakephp 3

我似乎无法找到任何关于如何在 cakephp3 中缓存整个 HTML 页面的信息,任何人都可以提供帮助,我能够在 cakephp 1.2 中做到这一点,如果我需要像url/products/show/1一样缓存整个页面,我在下面声明一个ProductsController,页面就会被缓存

var $cacheAction = array( 'show' => '72 hour');

另一个问题,cakephp3 中是否有类似的标签,它的作用类似于 cakephp1.2 中的 cake:nocache

谢谢

缓存助手已在 CakePHP 3 中删除,因为它不是一个合适的通用实现。如果您需要考虑动态内容,建议您使用像 Varnish or Squid, and use Edge Side Includes (ESI) 这样的缓存服务器。

Akamai、Cloudflare 等 CDN 也支持 ESI,甚至支持自定义实现。对于其他情况,如果您想推出自己的解决方案,请查看插件,例如 cakephp-cache, or learn about the CakePHP request cycle and middleware

另见