in2code/in2shortcutcache
Composer 安装命令:
composer require in2code/in2shortcutcache
包简介
Fixes cache lifetime for pages with shortcut (Insert Records) content elements in TYPO3
README 文档
README
Introduction
This TYPO3 extension fixes a known core issue (Forge #91561,
#93661) where the page cache lifetime is not correctly calculated
when "Insert Records" (CType = shortcut) content elements reference time-controlled target elements.
The Problem
When a shortcut element references a target element with a starttime or endtime, TYPO3 calculates the
cache lifetime only based on the shortcut record itself. Since the shortcut has no time settings, the
default lifetime of 86400 seconds (24 hours) is used — instead of the remaining time until the next
visibility change of the referenced target element.
This affects TYPO3's page cache in general: pages are served from cache even after a scheduled visibility change of a referenced element should have taken effect. Any caching layer built on top — such as staticfilecache — inherits the same incorrect lifetime and compounds the problem further.
The Solution
The extension listens to TYPO3's ModifyCacheLifetimeForPageEvent PSR-14 event. For each page render,
it:
- Queries all
CType = shortcutcontent elements on the current page - Parses their
recordsfield to find the referencedtt_contentUIDs - Reads the
starttimeandendtimeof those referenced records - Reduces the page cache lifetime to match the next scheduled visibility change
Installation
composer req in2code/in2shortcutcache
No further configuration is required. The extension registers its event listener automatically via
Configuration/Services.yaml.
Supported formats for the records field
The tt_content.records field (used by CType = shortcut) can contain UIDs in different formats.
All of the following are handled correctly:
| Format | Example | Handling |
|---|---|---|
| Plain integer UIDs | 123,456 |
Resolved as tt_content UIDs |
| Table-prefixed UIDs | tt_content_123,tt_content_456 |
Prefix stripped, resolved as tt_content UIDs |
| Mixed with other tables | pages_123,tt_content_234 |
Non-tt_content entries are ignored |
Scope
The following fields of the referenced tt_content records are considered:
| Source | Fields | Condition |
|---|---|---|
| TYPO3 core | starttime, endtime (Unix timestamps) |
Always |
| in2frequently | tx_in2frequently_starttime, tx_in2frequently_endtime (cron expressions) |
Only if in2code/in2frequently is installed and tx_in2frequently_active = 1 |
Support for in2frequently is optional. If the package is not installed, the behaviour is identical
to before. No configuration is required — the integration is activated automatically once
in2code/in2frequently is present.
The fix applies to direct shortcut references. Nested shortcuts (a shortcut referencing another shortcut that in turn references a time-controlled element) are currently not resolved transitively.
Configuration
The extension can be configured via the TYPO3 Extension Manager or LocalConfiguration.php under the
key in2shortcutcache.
| Option | Type | Default | Description |
|---|---|---|---|
enableDataHandlerCacheFlush |
bool | true |
When enabled, the page cache for all pages containing shortcut elements that reference a just-saved or deleted tt_content record is flushed immediately via the DataHandler hook. Disable this on large installations if the flush causes unwanted performance impact during backend saves. |
Changelog
| Version | Date | State | Description |
|---|---|---|---|
| 1.0.0 | 2026-04-13 | Task | Initial release |
in2code/in2shortcutcache 适用场景与选型建议
in2code/in2shortcutcache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 in2code/in2shortcutcache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 in2code/in2shortcutcache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-04-13