mirror of
https://github.com/nextcloud/server.git
synced 2026-02-10 22:34:26 -05:00
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>
35 lines
776 B
PHP
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;
|
|
}
|
|
}
|