pluswerk/cache-automation

此包已被 弃用 并不再维护。作者建议使用 andersundsehr/cache-automation 包。

+Pluswerk TYPO3 扩展:缓存自动化 - 该TYPO3扩展在正确的时间自动清理缓存。

安装次数: 7,865

依赖关系: 0

建议者: 0

安全性: 0

星标: 3

关注者: 9

分支: 3

开放问题: 3

类型:typo3-cms-extension

3.0.0 2024-08-19 13:05 UTC

README

.
.
.
.
请使用 andersundsehr/cache-automation 代替
.
.
.
.
.
.
.

Packagist Release Travis GitHub License Code Climate

TYPO3 扩展:缓存自动化

此TYPO3扩展在正确的时间自动清理缓存。这通过扩展的一些魔法配置来实现。

示例

使用此TYPO3扩展,您可以缓存例如extbase "列表和显示"插件。如果数据库记录被更新,包含此插件的页面的缓存将被清除。

您可以编写自己的魔法缓存代理。

需要TYPO3 8.7至TYPO3 9

问题跟踪: GitHub: TYPO3 缓存自动化

Packagist: pluswerk/cache-automation

安装

  1. 通过composer安装TYPO3扩展

Composer安装

composer require pluswerk/cache-automation

配置

配置缓存代理

在您的 ext_localconf.php 中配置扩展的缓存代理。

如果给定表的数据库记录已更改,则触发缓存代理。

示例

\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'],
    ]
);

可用的缓存代理

SimplePluginAgent

此代理清除具有给定插件键的所有页面的缓存。

\Pluswerk\CacheAutomation\Service\Configuration::getInstance()->addAgentForTables(
    ['tx_news_domain_model_news'],
    \Pluswerk\CacheAutomation\Agents\SimplePluginAgent::class,
    [
        'pluginKeys' => ['news_pi1'],
    ]
);

PageRootlineAgent

此代理清除给定页面的TYPO3 "根行"中的所有页面的缓存。

\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
    ]
);

使用您自己的缓存代理

您可以直接使用自己的缓存代理。它必须实现 \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];
    }
}