定制 wazum/cache-guard 二次开发

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

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

wazum/cache-guard

Composer 安装命令:

composer require wazum/cache-guard

包简介

Prevents backend cache flushes of protected cache groups in production-like contexts

README 文档

README

Tests PHP TYPO3 License

Deliberate cache control for TYPO3: protect the warmed system caches from destructive backend flushes between deployments, and flush precisely the caches you mean to. Editors keep clearing page caches, deployments keep flushing everything, and you can clear a single cache (e.g. fluid_template) instead of wiping the whole system group — while the bulk flush of warmed system caches stays locked in production.

Installation

composer require wazum/cache-guard

No setup needed — the defaults lock the system cache group in Production contexts.

Locking system-cache flushes

Between deployments the warmed system caches (compiled PHP code, Fluid templates, l10n, …) should not be wiped by a stray backend click. Cache Guard prevents that in production-like contexts, while everyday page-cache clearing keeps working.

What it blocks

  • Flushing of configured cache groups (default: system) in configured application contexts (default: Production, matched as prefix, so Production/Staging is included).
  • The full opcache reset triggered by "Flush all caches"; targeted single-file opcache invalidation keeps working.
  • It replaces the "Flush all caches" entry in the clear-cache toolbar with a disabled notice while the lock is active; the dropdown and "Flush frontend caches" stay in place.

Note

Intercepting the opcache reset requires TYPO3 13.4+ — on 12.4 the cache-group lock applies, but the opcache reset is not intercepted.

Clear-cache dropdown with the system cache flush locked

What it leaves alone

  • "Flush frontend caches" (pages) keeps working for editors.
  • CLI: vendor/bin/typo3 cache:flush always works — deployments are unaffected.
  • The Install Tool / Maintenance "Flush cache" and the DI container cache (system-maintainer territory).
  • Tag-based invalidation (flushCachesByTag/flushCachesByTags) — targeted invalidation is not a bulk clear.

Configuration

Admin Tools → Settings → Extension Configuration → cache_guard:

Option Default Description
lockedGroups system Comma-separated cache groups that must not be flushed from the backend
lockedContexts Production Comma-separated application context prefixes in which the lock is active

Defense in depth (optional)

Hide the "Flush all caches" entry per user/group via User TSconfig (UI only, the lock above is the actual enforcement):

options.clearCache.all = 0

Flushing individual caches (CLI)

Clear only specific caches without wiping a whole group — e.g. recompile Fluid templates after a deployment without touching the warmed PHP-code, l10n or DI caches:

vendor/bin/typo3 cache:flush --cache fluid_template
vendor/bin/typo3 cache:flush --cache fluid_template,l10n

All identifiers must be valid or nothing is flushed. The dependency injection cache is not flushable this way — use cache:flush --group di.

Run the option without a value (or with an unknown name) at a terminal to pick interactively:

vendor/bin/typo3 cache:flush --cache

Interactive cache picker

In CI and deployment, pass --no-interaction (-n) so a missing or unknown identifier fails with a clear error instead of opening the picker:

vendor/bin/typo3 cache:flush --cache fluid_template --no-interaction

Requirements

  • TYPO3 12.4, 13.4 or 14.3
  • PHP 8.2, 8.3, 8.4 or 8.5 (TYPO3 12.4 runs on 8.2–8.3)

License

GPL-2.0-or-later — see LICENSE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固