pluswerk / cache-automation
+Pluswerk TYPO3 extension: Cache Automation - This TYPO3 extension clear caches automated in the right moment.
Installs: 8 029
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 9
Forks: 3
Open Issues: 3
Type:typo3-cms-extension
Requires
- php: ~8.2.0 || ~8.3.0
- typo3/cms-core: ^11.5 || ^12.4
Requires (Dev)
- pluswerk/grumphp-config: ^7
- saschaegerer/phpstan-typo3: ^1.10.0
- ssch/typo3-rector: ^2.5.0
This package is auto-updated.
Last update: 2024-08-19 13:06:50 UTC
README
.
.
.
.
Use andersundsehr/cache-automation instead
.
.
.
.
.
.
.
TYPO3 Extension: Cache Automation
This TYPO3 extension clear caches automated in the right moment. This happens by some magic configuration of your extension.
Example:
With this TYPO3 extension you can cache for example an extbase "list and show" plugin. If a database record is updated the cache of all pages containing this plugin will be flushed.
You can write your own magic cache agent.
Requires TYPO3 8.7 up to TYPO3 9
Issue tracking: GitHub: TYPO3 Cache Automation
Packagist: pluswerk/cache-automation
Installation
- Install the TYPO3 extension via composer
Composer installation:
composer require pluswerk/cache-automation
Configuration
Configure cache agent
Configure a cache agent for your extension in your ext_localconf.php
.
A cache agent is triggered, if a database record of the given tables has changed.
Example:
\Pluswerk\CacheAutomation\Service\Configuration::getInstance()->addAgentForTables( ['tx_news_domain_model_news'], // database table name \Pluswerk\CacheAutomation\Agents\SimplePluginAgent::class, // cache agent [ // cache agent configuration 'pluginKeys' => ['news_pi1'], ] );
Available cache agents
SimplePluginAgent
This agent flush the cache of all pages which have a content element with the given plugin keys.
\Pluswerk\CacheAutomation\Service\Configuration::getInstance()->addAgentForTables( ['tx_news_domain_model_news'], \Pluswerk\CacheAutomation\Agents\SimplePluginAgent::class, [ 'pluginKeys' => ['news_pi1'], ] );
PageRootlineAgent
This agent flush the cache of all pages which are in the TYPO3 "rootline" of the given pages.
\Pluswerk\CacheAutomation\Service\Configuration::getInstance()->addAgentForTables( ['tx_news_domain_model_news'], \Pluswerk\CacheAutomation\Agents\PageRootlineAgent::class, [ 'rootPages' => [42, 316], 'depth' => 99, // optional 'begin' => 0, // optional ] );
Use your own cache agent
You can simply use your own cache agent. It has to implement \Pluswerk\CacheAutomation\Agents\AgentInterface
:
class MyMagicCacheAgent implements \Pluswerk\CacheAutomation\Agents\AgentInterface { public function getExpiredPages(string $table, int $uid, array $agentConfiguration, array $changedFields): array { // doe some magic here and return all page uid's which caches should be flushed return [42, 316]; } }