重定向时 TYPO3 扩展控制器中的缓存问题

Caching problem in TYPO3 extension controller while redirecting

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

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

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

在重定向之前,包括:

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

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

您还可以在 ext_localconf.php

中将操作定义为不可缓存的操作
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'TYPO3.' . $_EXTKEY,
    'Yourplugin',
    array(
        'Controller' => 'list, delete',
    ),
    // non-cacheable actions
    array(
        'Controller' => 'list, delete',
    )
);