---
title: "Events"
manual: "Myra Cloud Connector"
version: "4.1"
source: "Reference/Events.rst"
modified: "2026-09-16T08:29:39+00:00"
---

# Events

## ClearMyraCloudCacheEvent

> [!NOTE]
> **New in version 3.3.0 / 4.1.0**
>
> [Feature #155 - Introduce and use ClearMyraCloudCacheEvent for cache flush](https://github.com/CPS-IT/myra-cloud-connector/pull/155)

`\CPSIT\MyraCloudConnector\Event\ClearMyraCloudCacheEvent` is a PSR-14
event dispatched by every built-in trigger of a Myra Cloud cache clear
request:

-   the [CLI command](CLI-Command.html#cli-command)
-   the backend AJAX endpoint used by the clear-cache buttons, the clear-cache
    menu entries and the context menu action
-   the AutoClear hooks ([page update](AutoClear-Hooks.html#page-update-hook) and
    [file replace](AutoClear-Hooks.html#file-replace-hook))

```php
final class ClearMyraCloudCacheEvent
{
    public function __construct(
        public readonly Typo3CacheType $type,
        public readonly ?string $identifier = null,
        public readonly ?int $languageId = null,
    ) {}

    public function getCacheResult(): ?bool;
    public function setCacheResult(bool $result): void;
}
```

`type`, `identifier` and `languageId` describe what should be
cleared (see [CLI command](CLI-Command.html#cli-usage) for the meaning of these values
per type). A listener is expected to report the outcome of the clear request
via `setCacheResult()`; callers read it back via `getCacheResult()`.

## Default listener

`\CPSIT\MyraCloudConnector\EventListener\ExternalClearCacheListener` is
registered by default. It resolves the affected page (for the `page` type
when no explicit language is given), forwards the request to the configured
Myra adapter, de-duplicates repeated requests for the same
identifier/language within a request via the TYPO3 runtime cache, and
reports the result back on the event.

## Custom listeners

Register an additional listener on `ClearMyraCloudCacheEvent` (via
`#[AsEventListener]` or `Configuration/Services.yaml`) to react to
a clear request, for example to clear an additional external cache alongside
Myra Cloud, or to log specific requests.
