From 26c91bd745341925c9453476391578b7a3acc3a2 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 15 Jul 2026 16:51:59 +0200 Subject: [PATCH] chore: undeprecate the redis cache backend There are good reasons to have both backends supported, first the phpredis backend allows in some cases for higher performance. But also predis allows to use redis / valkey in cases where: - phpredis does not yet support a new version of valkey / redis - its not possible to install 3rdparty PHP extensions like phpredis Signed-off-by: Ferdinand Thiessen --- .../composer/composer/autoload_classmap.php | 1 - .../composer/composer/autoload_static.php | 1 - apps/settings/lib/AppInfo/Application.php | 2 - .../lib/SetupChecks/MemcacheLegacy.php | 59 ------------------- build/psalm-baseline.xml | 5 -- config/config.sample.php | 17 +++--- lib/private/Memcache/Redis.php | 6 -- lib/private/RedisFactory.php | 3 - 8 files changed, 10 insertions(+), 84 deletions(-) delete mode 100644 apps/settings/lib/SetupChecks/MemcacheLegacy.php diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php index fd53a6072dc1a..4bcfd9d5788f9 100644 --- a/apps/settings/composer/composer/autoload_classmap.php +++ b/apps/settings/composer/composer/autoload_classmap.php @@ -110,7 +110,6 @@ 'OCA\\Settings\\SetupChecks\\LoggingLevel' => $baseDir . '/../lib/SetupChecks/LoggingLevel.php', 'OCA\\Settings\\SetupChecks\\MaintenanceWindowStart' => $baseDir . '/../lib/SetupChecks/MaintenanceWindowStart.php', 'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => $baseDir . '/../lib/SetupChecks/MemcacheConfigured.php', - 'OCA\\Settings\\SetupChecks\\MemcacheLegacy' => $baseDir . '/../lib/SetupChecks/MemcacheLegacy.php', 'OCA\\Settings\\SetupChecks\\MimeTypeMigrationAvailable' => $baseDir . '/../lib/SetupChecks/MimeTypeMigrationAvailable.php', 'OCA\\Settings\\SetupChecks\\MysqlRowFormat' => $baseDir . '/../lib/SetupChecks/MysqlRowFormat.php', 'OCA\\Settings\\SetupChecks\\MysqlUnicodeSupport' => $baseDir . '/../lib/SetupChecks/MysqlUnicodeSupport.php', diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php index 6f2cd713307df..7caeb50d3c711 100644 --- a/apps/settings/composer/composer/autoload_static.php +++ b/apps/settings/composer/composer/autoload_static.php @@ -125,7 +125,6 @@ class ComposerStaticInitSettings 'OCA\\Settings\\SetupChecks\\LoggingLevel' => __DIR__ . '/..' . '/../lib/SetupChecks/LoggingLevel.php', 'OCA\\Settings\\SetupChecks\\MaintenanceWindowStart' => __DIR__ . '/..' . '/../lib/SetupChecks/MaintenanceWindowStart.php', 'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => __DIR__ . '/..' . '/../lib/SetupChecks/MemcacheConfigured.php', - 'OCA\\Settings\\SetupChecks\\MemcacheLegacy' => __DIR__ . '/..' . '/../lib/SetupChecks/MemcacheLegacy.php', 'OCA\\Settings\\SetupChecks\\MimeTypeMigrationAvailable' => __DIR__ . '/..' . '/../lib/SetupChecks/MimeTypeMigrationAvailable.php', 'OCA\\Settings\\SetupChecks\\MysqlRowFormat' => __DIR__ . '/..' . '/../lib/SetupChecks/MysqlRowFormat.php', 'OCA\\Settings\\SetupChecks\\MysqlUnicodeSupport' => __DIR__ . '/..' . '/../lib/SetupChecks/MysqlUnicodeSupport.php', diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index 4354d3330b5aa..a59949dc14462 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -48,7 +48,6 @@ use OCA\Settings\SetupChecks\LegacySSEKeyFormat; use OCA\Settings\SetupChecks\MaintenanceWindowStart; use OCA\Settings\SetupChecks\MemcacheConfigured; -use OCA\Settings\SetupChecks\MemcacheLegacy; use OCA\Settings\SetupChecks\MimeTypeMigrationAvailable; use OCA\Settings\SetupChecks\MysqlRowFormat; use OCA\Settings\SetupChecks\MysqlUnicodeSupport; @@ -190,7 +189,6 @@ public function register(IRegistrationContext $context): void { $context->registerSetupCheck(LegacySSEKeyFormat::class); $context->registerSetupCheck(MaintenanceWindowStart::class); $context->registerSetupCheck(MemcacheConfigured::class); - $context->registerSetupCheck(MemcacheLegacy::class); $context->registerSetupCheck(MimeTypeMigrationAvailable::class); $context->registerSetupCheck(MysqlRowFormat::class); $context->registerSetupCheck(MysqlUnicodeSupport::class); diff --git a/apps/settings/lib/SetupChecks/MemcacheLegacy.php b/apps/settings/lib/SetupChecks/MemcacheLegacy.php deleted file mode 100644 index 753bc2ad5c739..0000000000000 --- a/apps/settings/lib/SetupChecks/MemcacheLegacy.php +++ /dev/null @@ -1,59 +0,0 @@ -l10n->t('Redis cache'); - } - - #[\Override] - public function getCategory(): string { - return 'system'; - } - - #[\Override] - public function run(): SetupResult { - if ($this->isLegacyRedisUsed()) { - return SetupResult::info( - $this->l10n->t('You are still using the old Redis cache backend. For full support of latest Valkey and Redis features, like clustering and sentinel, please switch to the new KeyValueCache backend.'), - $this->urlGenerator->linkToDocs('admin-cache') - ); - } else { - return SetupResult::success($this->l10n->t('No legacy Redis cache detected')); - } - } - - protected function isLegacyRedisUsed(): bool { - $memcacheDistributedClass = $this->config->getSystemValue('memcache.distributed', null); - $memcacheLockingClass = $this->config->getSystemValue('memcache.locking', null); - - /** @psalm-suppress DeprecatedClass */ - if ($memcacheDistributedClass === Redis::class || $memcacheLockingClass === Redis::class) { - return true; - } - return false; - } -} diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 07d6b6ae302fd..ad09464c36626 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -3024,11 +3024,6 @@ timeFactory->getTime()]]> - - - - - diff --git a/config/config.sample.php b/config/config.sample.php index 20d3fcd2d9384..a91df0ad5d049 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1787,9 +1787,16 @@ * Connection details for the Key-Value store used for in-memory caching, * for example when using Valkey or Redis. * - * This is the brand-independent successor of the ``redis`` and - * ``redis.cluster`` options below and supports the latest Valkey and Redis - * releases. Three topologies are supported: + * This is the brand-independent version of the ``redis`` and + * ``redis.cluster`` options below without depending on ``php-redis`` + * meaning no additional PHP extension needs to be installed. + * Redis and Valkey 4.0 up to 8.0 are supported, for SSL support Redis v6 or higher is required, + * Valkey 9 is supported but without support for numbered databased when using cluster mode. + * + * Warning: If the cache server is not hosted on the same machine as Nextcloud, + * this can have a network overhead compared to the ``php-redis`` based backend below. + * + * Three topologies are supported: * a single server, a Sentinel managed replication set, and a * server cluster. Configure exactly one of ``server``, ``sentinel`` or * ``seeds``. @@ -1873,8 +1880,6 @@ * * We also support Redis SSL/TLS encryption as of version 6. * See https://redis.io/topics/encryption for more information. - * - * @deprecated 34.0.0 use `memcache.kvstore` instead which supports also Valkey. */ 'redis' => [ 'host' => 'localhost', // can also be a Unix domain socket: '/tmp/redis.sock' @@ -1914,8 +1919,6 @@ * * Authentication works with phpredis version 4.2.1+. See * https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1 - * - * @deprecated 34.0.0 use `memcache.kvstore` instead which supports also Valkey. */ 'redis.cluster' => [ 'seeds' => [ // provide some or all of the cluster servers to bootstrap discovery, port required diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 20db183b93aca..034c940d8067b 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -10,12 +10,6 @@ use OCP\IMemcacheTTL; use OCP\Server; -/** - * @deprecated 34.0.2 Legacy phpredis based backend. Kept so existing `redis` - * and `redis.cluster` configurations keep working. New setups should - * use {@see KeyValueCache} with the `memcache.kvstore` configuration, - * which also supports Valkey. - */ class Redis extends Cache implements IMemcacheTTL { /** name => [script, sha1] */ public const LUA_SCRIPTS = [ diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index d09003c9c077a..4c8160d81d1f1 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -9,9 +9,6 @@ use OCP\Diagnostics\IEventLogger; -/** - * @deprecated 34.0.2 - use {@see \OC\Memcache\KeyValueCacheFactory} instead - */ class RedisFactory { public const REDIS_MINIMAL_VERSION = '4.0.0'; public const REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION = '5.3.0';