diff --git a/lib/Service/ExAppService.php b/lib/Service/ExAppService.php index 4c64b8de..204d90ec 100644 --- a/lib/Service/ExAppService.php +++ b/lib/Service/ExAppService.php @@ -24,6 +24,7 @@ use OCP\DB\Exception; use OCP\ICache; use OCP\ICacheFactory; +use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; use Psr\Log\LoggerInterface; @@ -53,9 +54,17 @@ public function __construct( private readonly SettingsService $settingsService, private readonly ExAppEventsListenerService $eventsListenerService, private readonly ExAppOccService $occService, + private readonly IConfig $config, ) { if ($cacheFactory->isAvailable()) { - $this->cache = $cacheFactory->createDistributed(Application::APP_ID . '/service'); + $distributedCacheClass = ltrim($config->getSystemValueString('memcache.distributed', ''), '\\'); + $localCacheClass = ltrim($config->getSystemValueString('memcache.local', ''), '\\'); + if ( + ($distributedCacheClass === '' && ($localCacheClass !== \OC\Memcache\APCu::class)) && + ($distributedCacheClass !== \OC\Memcache\APCu::class) + ) { + $this->cache = $cacheFactory->createDistributed(Application::APP_ID . '/service'); + } } } diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 18bc02ac..6f22d8aa 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -112,4 +112,10 @@ + + + + + +