From 3a76c5700067dd089c4e4abedabfc928f750468e 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 9cf7a03ea3baa..a526b46873f77 100644 --- a/apps/settings/composer/composer/autoload_classmap.php +++ b/apps/settings/composer/composer/autoload_classmap.php @@ -111,7 +111,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 be6408b7567f6..2cba33bd7dcb4 100644 --- a/apps/settings/composer/composer/autoload_static.php +++ b/apps/settings/composer/composer/autoload_static.php @@ -126,7 +126,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 2ec391f66e2e9..ff1f0d222f0e8 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -49,7 +49,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; @@ -195,7 +194,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 efa021309ae09..a4694e6153dcc 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -3002,11 +3002,6 @@ timeFactory->getTime()]]> - - - - - diff --git a/config/config.sample.php b/config/config.sample.php index 55ceb784df971..19e5e7f3d0300 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1795,9 +1795,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``. @@ -1881,8 +1888,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' @@ -1922,8 +1927,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 4f44197e233c7..b3d41a6717963 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -12,12 +12,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 b867e4e6aa52f..722c356d9d879 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -10,9 +10,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';