refactor(Server): Deprecate \OCP\ICache service and replace it with a distributed cache

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2025-06-02 15:36:57 +02:00
parent 24f7a2e680
commit 57191d451f
No known key found for this signature in database

View file

@ -588,7 +588,13 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerAlias(IURLGenerator::class, URLGenerator::class);
$this->registerService(ICache::class, function ($c) {
return new Cache\File();
/** @var LoggerInterface $logger */
$logger = $c->get(LoggerInterface::class);
$logger->debug('The requested service "' . ICache::class . '" is deprecated. Please use "' . ICacheFactory::class . '" instead to create a cache. This service will be removed in a future Nextcloud version.', ['app' => 'serverDI']);
/** @var ICacheFactory $cacheFactory */
$cacheFactory = $c->get(ICacheFactory::class);
return $cacheFactory->createDistributed();
});
$this->registerService(Factory::class, function (Server $c) {