简体   繁体   English

错误的 TYPO3 页面缓存

[英]Wrong TYPO3 Page Cache

This Problem occurs sporadically on Pages with a large Number of visitors.此问题偶尔会出现在有大量访问者的页面上。 Sometimes TYPO3 displays the content of a completely different page (including the HTML head Section).有时 TYPO3 会显示完全不同页面的内容(包括 HTML 标题部分)。

For example, if the user calls the following page: /products/ (default Controller ProductController with listAction ) TYPO3 shows the content of a random Controller and action of the same Plugin on the Page (like ApplicationController with showAction ).例如,如果用户调用以下页面: /products/ (带有listAction默认控制器ProductController ) TYPO3 显示随机控制器的内容和页面上相同插件的操作(如带有showAction ApplicationController )。 The Site does not redirect to another Page, it's just showing wrong content!该站点不会重定向到另一个页面,它只是显示了错误的内容!

I already tried the following things:我已经尝试了以下事情:

  • I added the Controller + action to the nonCacheableControllerActions (Problem occurs a day later again)我将 Controller + action 添加到nonCacheableControllerActions (问题再次发生在一天后)
  • Adding ?no_cache=1 to the URL (Problem is solved, but the page speed is reduced)在URL中添加?no_cache=1 (问题解决,但页面速度降低)
  • Clearing Cache (Problem is solved, no matter what cache is cleared. But the Problem occurs a day later again)清除缓存(问题解决,不管清除什么缓存。但问题又出现了一天)
  • I wrote a script which called the page every few minutes which seems to fix the problem.我写了一个脚本,每隔几分钟调用一次页面,这似乎解决了这个问题。

Does anybody else have the same Problem?有没有其他人有同样的问题?

Specifications:规格:

  • TYPO3 Version: 7.6.22 TYPO3 版本: 7.6.22
  • realurl Version: 2.2.1真实网址版本: 2.2.1

Those caching problems are usually occuring because of wrong or missing cHashes.这些缓存问题通常是由于 cHash 错误或丢失而发生的。

You can use $GLOBALS['TSFE']→reqCHash();您可以使用$GLOBALS['TSFE']→reqCHash(); in your controller's actions.在您的控制器的操作中。 This disables Caching if no cHash is set, therefore making sure you don't get incorrect cache entries.如果未设置 cHash,这将禁用缓存,因此确保您不会获得不正确的缓存条目。 Please note: If you set [pageNotFoundOnCHashError] = 1 in your system settings you will get page not found errors when the page is called without cHash, if it's set to 0 the page will still be displayed but not cached.请注意:如果您在系统设置中设置 [pageNotFoundOnCHashError] = 1,当在没有 cHash 的情况下调用页面时,您将收到页面未找到错误,如果设置为 0,页面仍将显示但不会缓存。


The following information may be outdated, see moe2k's answer below for more current information.以下信息可能已过时,请参阅下面的 moe2k 回答以获取更多最新信息。

Alternatively, there is a system parameter "[FE][cHashRequiredParameters]" - you can add your plugin parameters there.或者,有一个系统参数“[FE][cHashRequiredParameters]” - 您可以在那里添加您的插件参数。 If no cHash is given but one of the parameters are set, then TYPO3 triggers the configured cHash Error behaviour.如果没有给出 cHash 但设置了其中一个参数,则 TYPO3 会触发配置的 cHash 错误行为。 I believe cHashes are then set automatically for typolinks, you can try and see though.我相信 cHashes 然后会自动设置为拼写链接,您可以尝试看看。 If they aren't set automatically you should set "useCacheHash = 1" on your links to the show action.如果它们不是自动设置的,您应该在指向 show 操作的链接上设置“useCacheHash = 1”。

I prefer & use the first variant.我更喜欢 & 使用第一个变体。

Try defining the plugin as USER_INT.尝试将插件定义为 USER_INT。 plugin.tx_yourextkey = USER_INT plugin.tx_yourextkey = USER_INT

This will tell TYPO3 to render the code for each request.这将告诉 TYPO3 为每个请求呈现代码。

Best practice would be a second page for the showAction, and only on the single_view page, define the plugin as USER_INT.最佳实践是 showAction 的第二个页面,并且仅在 single_view 页面上,将插件定义为 USER_INT。

But is you have two pages for this you should not experience this problem.但是如果你有两个页面,你应该不会遇到这个问题。 And not need the USER_INT setting.并且不需要 USER_INT 设置。

Since TYPO3 v9, use the following:从 TYPO3 v9 开始,请使用以下内容:

$TYPO3_CONF_VARS['FE']['cacheHash']['requireCacheHashPresenceParameters']

with an array as value instead of使用数组作为值而不是

$TYPO3_CONF_VARS['FE']['cacheHash']['cHashRequiredParameters']

with a comma-separated list.用逗号分隔的列表。

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

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