AfterCachedPageIsPersistedEvent 

The PSR-14 event \TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent is commonly used to generate a static file cache. This event is only called if the page was actually stored in TYPO3's page cache.

Example 

EXT:my_extension/Classes/Frontend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Frontend\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent;

#[AsEventListener(
  identifier: 'my-extension/content-modifier',
)]
final readonly class MyEventListener
{
  public function __invoke(AfterCachedPageIsPersistedEvent $event): void
  {
    // generate static file cache
  }
}
Copied!

API 

final class AfterCachedPageIsPersistedEvent
Fully qualified name
\TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent

Event that is used directly after all cached content is stored in the page cache.

NOT fired, if: A page is called from the cache Caching is disabled using 'frontend.cache.instruction' request attribute, which can be set by various middlewares or AfterCacheableContentIsGeneratedEvent

getRequest()
Returns
\Psr\Http\Message\ServerRequestInterface
getCacheIdentifier()
Returns
string
getCacheData()
Returns
array
getCacheLifetime()

The amount of seconds until the cache entry is invalid.

Returns
int