nextcloud/lib/public/Files/Cache/CacheEntriesRemovedEvent.php
Carl Schwan fd3878448b
feat(filecache): Scale DB query created when deleting file from filecache
Instead of creating a CacheEntryRemovedEvent for each deleted files,
create a single CacheEntriesRemovedEvent which wrap multiple
CacheEntryRemovedEvent.

This allow listener to optimize the query they do when multiple files
are deleted at the same time (e.g. when deleting a folder).

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
2026-01-28 16:07:57 +01:00

35 lines
776 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Files\Cache;
use OCP\EventDispatcher\Event;
/**
* Meta-event wrapping multiple CacheEntryRemovedEvent for when an existing
* entry in the cache gets removed.
*
* @since 32.0.0
*/
#[\OCP\AppFramework\Attribute\Listenable(since: '32.0.0')]
class CacheEntriesRemovedEvent extends Event {
/**
* @param CacheEntryRemovedEvent[] $cacheEntryRemovedEvents
*/
public function __construct(
private readonly array $cacheEntryRemovedEvents,
) {
}
/**
* @return CacheEntryRemovedEvent[]
*/
public function getCacheEntryRemovedEvents(): array {
return $this->cacheEntryRemovedEvents;
}
}