diff --git a/CHANGELOG.md b/CHANGELOG.md index cddeac55..26e141e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this When trying to delete orphan visits the result will also be `0` and no visits will actually get deleted. +* [#1879](https://github.com/shlinkio/shlink/issues/1879) Cache namespace can now be customized via config option or `CACHE_NAMESPACE` env var. + + This is important if you are running multiple Shlink instance on the same server, or they share the same Redis instance (even more so if they are on different versions). + ### Changed * [#1799](https://github.com/shlinkio/shlink/issues/1799) RoadRunner/openswoole jobs are not run anymore for tasks that are actually disabled. diff --git a/composer.json b/composer.json index 4b0bfc61..4f8ca4df 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "shlinkio/shlink-config": "dev-main#c0aa01f as 2.5", "shlinkio/shlink-event-dispatcher": "dev-main#bd3a62b as 3.1", "shlinkio/shlink-importer": "^5.1", - "shlinkio/shlink-installer": "^8.5", + "shlinkio/shlink-installer": "dev-develop#a665623 as 8.6", "shlinkio/shlink-ip-geolocation": "^3.2", "shlinkio/shlink-json": "^1.0", "spiral/roadrunner": "^2023.2", @@ -72,7 +72,7 @@ "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", "phpunit/php-code-coverage": "^10.1", - "phpunit/phpunit": "^10.3", + "phpunit/phpunit": "^10.4", "roave/security-advisories": "dev-master", "shlinkio/php-coding-standard": "~2.3.0", "shlinkio/shlink-test-utils": "^3.7.1", diff --git a/config/autoload/cache.global.php b/config/autoload/cache.global.php index 614b140f..94a9a183 100644 --- a/config/autoload/cache.global.php +++ b/config/autoload/cache.global.php @@ -16,7 +16,7 @@ return (static function (): array { return [ 'cache' => [ - 'namespace' => 'Shlink', + 'namespace' => EnvVars::CACHE_NAMESPACE->loadFromEnv('Shlink'), ...$cacheRedisBlock, ], 'redis' => $redis, diff --git a/config/autoload/installer.global.php b/config/autoload/installer.global.php index 966e36ee..0aa849e0 100644 --- a/config/autoload/installer.global.php +++ b/config/autoload/installer.global.php @@ -28,6 +28,7 @@ return [ Option\Visit\VisitsThresholdConfigOption::class, Option\BasePathConfigOption::class, Option\TimezoneConfigOption::class, + Option\Cache\CacheNamespaceConfigOption::class, Option\Worker\TaskWorkerNumConfigOption::class, Option\Worker\WebWorkerNumConfigOption::class, Option\Redis\RedisServersConfigOption::class, diff --git a/module/CLI/test/Util/CliTestUtils.php b/module/CLI/test/Util/CliTestUtils.php index 62dd6e4f..9c92f882 100644 --- a/module/CLI/test/Util/CliTestUtils.php +++ b/module/CLI/test/Util/CliTestUtils.php @@ -22,8 +22,9 @@ class CliTestUtils $generator = new Generator(); } - $command = $generator->getMock( + $command = $generator->testDouble( Command::class, + mockObject: true, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, diff --git a/module/Core/src/Config/EnvVars.php b/module/Core/src/Config/EnvVars.php index ec7d384c..1a917928 100644 --- a/module/Core/src/Config/EnvVars.php +++ b/module/Core/src/Config/EnvVars.php @@ -17,6 +17,7 @@ enum EnvVars: string case DB_UNIX_SOCKET = 'DB_UNIX_SOCKET'; case DB_PORT = 'DB_PORT'; case GEOLITE_LICENSE_KEY = 'GEOLITE_LICENSE_KEY'; + case CACHE_NAMESPACE = 'CACHE_NAMESPACE'; case REDIS_SERVERS = 'REDIS_SERVERS'; case REDIS_SENTINEL_SERVICE = 'REDIS_SENTINEL_SERVICE'; case REDIS_PUB_SUB_ENABLED = 'REDIS_PUB_SUB_ENABLED';