TYPO3 - Disable cache for an extension

you need to pay attention to three locations. First have a look at your ext_localconf.php file. For each plugin (by plugin i mean Frontend Plugin) there is a line similar to this one:

t3lib_extMgm::addPItoST43($_EXTKEY, 'pi1/class.tx_yourext_pi1.php', '_pi1', 'list_type', 1);

To disable the cache you need to set the last value to zero, like this.

t3lib_extMgm::addPItoST43($_EXTKEY, 'pi1/class.tx_yourext_pi1.php', '_pi1', 'list_type', 0);

Within the Plugin's PHP file (e.g. pi1/class.tx_yourext_pi1.php) you need to ensure that the following line is either deleted, commented out or changed to "false"

$pi_checkCHash = true;

At last, add this line to your main() function (somewhere below the rest):

$this->pi_USER_INT_obj = 1;

That should do it.

cu Roman


Using $GLOBALS['TSFE']->set_no_cache() will disable caching for the entire page!

Call the function $GLOBALS["TSFE"]->set_no_cache(), if you want to disable caching of the page. Call this during development! And call it, if the content you create may not be cached.

Other sources are explanatory.

Instead, make sure that your extension is of type USER_INT, cf. the docs.

$this->pi_USER_INT_obj = 1;

Also to disable or limit the caching time on a per page basis might be a solution The setting is under pageicon edit -> tab behaviour -> cache settings (the ?no_cache=1 url parameter)

Another way would be to clear the cache when the data was changed in a sysfolder / set an autoclear in its ts page config for single pages TCEMAIN.clearCacheCmd = 1,3,5 -- numbers are pid comma seperated TCEMAIN.clearCacheCmd = all -- or clear cache all

http://typo3blog.at/blog/artikel/typo3-caching-grundlagen/

http://typo3weblog.de/2008/07/26/tcemainclearcachecmd-statt-clear-cache-button/


Unfortunately these answers are more than 8 years old. Nowadays the ExtensionUtility class supplies a switch for disabling caching based on actions:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'MyCompany.' . $_EXTKEY,
    'Sample',
    ['Sample' => 'index'],
    // non-cacheable actions:
    ['Sample' => 'index']
);

https://docs.typo3.org/typo3cms/ExtbaseFluidBook/4-FirstExtension/7-configuring-the-plugin.html

Tags:

Typo3