feat: page, hash and rootline caches in Redis again, as on TYPO3 10

Since every page view goes through TYPO3 13, the page cache is on the hot
path; TYPO3 10 kept it in Redis, TYPO3 13 had it in MySQL. Same socket and
options as TYPO3 10, but databases 3-5 instead of 0-2, which may still
hold TYPO3 10 entries in a format TYPO3 13 must not read. DDEV gets the
redis add-on for the same setup locally.

Without a Redis connection the backend logs an alert and misses, so pages
still render (slower); a missing PHP redis extension, however, fails hard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-24 18:51:57 +02:00
1 parent 520feb003f
commit df3d823de4
7 files changed
+269

No files matched your search

+30
View File
@@ -64,6 +64,36 @@ if (getenv('IS_DDEV_PROJECT') == 'true') {
);
}
// Redis caches as on TYPO3 10, but in databases 3-5: 0-2 may still hold TYPO3 10 entries. Without a
// connection the backend only logs an alert and every lookup is a miss, so pages still render.
$redisOptions = getenv('IS_DDEV_PROJECT') == 'true'
? ['hostname' => 'redis', 'port' => 6379]
: ['hostname' => '/run/redis_eptypo3/redis.sock', 'port' => 0];
$redisOptions['connectionTimeout'] = 2;
// These replace the definitions from settings.php wholesale, so 'groups' and the compression and
// lifetime options have to be repeated here. Each cache has its own database: RedisBackend::flush()
// issues FLUSHDB.
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pages'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 3, 'compression' => true],
'groups' => ['pages'],
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['hash'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 4],
'groups' => ['pages'],
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 5, 'compression' => true, 'defaultLifetime' => 2592000],
'groups' => ['pages'],
];
unset($redisOptions);
// Deployer creates an empty secrets.php if none exists yet: only an array counts
$secrets = is_file(__DIR__ . '/secrets.php') ? require __DIR__ . '/secrets.php' : null;
if (is_array($secrets)) {