定制 inspiredminds/contao-future-cache-invalidation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inspiredminds/contao-future-cache-invalidation

最新稳定版本:1.2.0

Composer 安装命令:

composer require inspiredminds/contao-future-cache-invalidation

包简介

Invalidates cache tags in the future for any DCA in Contao that has a `start` or `stop` field.

README 文档

README

Contao Future Cache Invalidation

Invalidates cache tags in the future for any DCA that has a start or stop field.

In Contao 5 you will only need to route the message manually:

# config/config.yaml
framework:
    messenger:
        routing:
            'InspiredMinds\ContaoFutureCacheInvalidation\Message\InvalidateCacheMessage': contao_prio_high

In Contao 4.13 you will also have to create a messenger transport, e.g.:

framework:
    messenger:
        transports:
            cache_invalidation: 'doctrine://default?queue_name=cache_invalidation'
        routing:
            'InspiredMinds\ContaoFutureCacheInvalidation\Message\InvalidateCacheMessage': cache_invalidation

If you use such a doctrine:// transport you will also have to install symfony/doctrine-messenger:

composer require symfony/doctrine-messenger

Then you have to consume the messages somehow via

vendor/bin/contao-console messenger:consume cache_invalidation

e.g. via a crontab entry like this:

* * * * * /usr/bin/php /var/www/example.com/vendor/bin/contao-console messenger:consume cache_invalidation --time-limit=59 --quiet

There is still a caveat: the cache invalidation is based on the contao.db.*.* cache tags. However, this will not work for the start case, as the cache tag would be missing for that URL. For child elements like articles, content elements or news (child of a news archive) it will still work as the extension will also invalidate the tags of the parent. But for pages for example this would not be solved this way - i.e. when you have a start time for page, it would still not show up in the menu of cached pages. In this case the extension clears the whole cache instead.

Note: as this utilizes the Symfony Messenger with its DelayStamp it will only work for the following messenger transport types:

  • doctrine
  • amqp
  • redis

There is also a command with which you can create these future cache invalidation messages for all existing database entries after installation:

vendor/bin/contao-console contao_future_cache_invalidation:create-messages

统计信息

  • 总下载量: 710
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2025-03-31