【问题标题】:Caching problem in TYPO3 extension controller while redirecting重定向时 TYPO3 扩展控制器中的缓存问题
【发布时间】:2019-12-04 09:19:09
【问题描述】:

当删除操作被调用时,记录在数据库中被删除,但是当它被重定向到 listAction 时,值仍然存在,直到缓存在 TYPO3 后端被刷新。

public function listAction()
{
 // some code here
}

public function deleteAction()
{
  // some code here
  $this->redirect('list');     
}

【问题讨论】:

  • 如果您想在未来获得问题的答案,请花更多时间正确格式化您的代码 sn-ps 并为您的问题写一个可读的描述! stackoverflow.com/help/how-to-ask

标签: caching model-view-controller typo3 extbase


【解决方案1】:

在重定向之前,包括以下内容:

$this->cacheService->clearPageCache([$pageIds]);

其中$pageIds 是您需要清除的页面的UID 数组。

【讨论】:

    【解决方案2】:

    您还可以在 ext_localconf.php 中将操作定义为不可缓存的操作

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'TYPO3.' . $_EXTKEY,
        'Yourplugin',
        array(
            'Controller' => 'list, delete',
        ),
        // non-cacheable actions
        array(
            'Controller' => 'list, delete',
        )
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-06
      • 1970-01-01
      • 2011-07-15
      • 1970-01-01
      • 1970-01-01
      • 2013-08-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多