---
title: "Feature: #97862 - New PSR-14 events for manipulating frontend page generation and cache behaviour"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-97862-1657195761"
source: "Changelog/12.0/Feature-97862-NewPSR-14EventsForManipulatingFrontendPageGenerationAndCacheBehaviour.rst"
typo3-version: "12.0"
typo3-major: 12
type: "feature"
issue: 97862
forge: "https://forge.typo3.org/issues/97862"
tags: ["Frontend", "PHP-API", "ext:frontend"]
rendered: "2026-09-23T19:53:57+00:00"
---

# Feature: #97862 - New PSR-14 events for manipulating frontend page generation and cache behaviour {#feature-97862-1657195761}

See [forge#97862](https://forge.typo3.org/issues/97862)

## Description {#description}

Two new PSR-14 events have been added:

-   `\TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent`
-   `\TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent`

They are added in favor of the [removed hooks](https://docs.typo3.org/permalink/changelog:breaking-97862-1657195630):

-   `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached']`
-   `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']`
-   `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['usePageCache']`
-   `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['insertPageIncache']`

Both events are called when the content of a page has been
generated in the TYPO3 Frontend.

## Example {#example}

Registration of the `AfterCacheableContentIsGeneratedEvent` in your extension's `Services.yaml`:

```yaml
MyVendor\MyPackage\Backend\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-package/content-modifier'
```

The corresponding event listener class:

```php
use TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent;

class MyEventListener {

    public function __invoke(AfterCacheableContentIsGeneratedEvent $event): void
    {
        // Only do this when caching is enabled
        if (!$event->isCachingEnabled()) {
            return;
        }
        $event->getController()->content = str_replace('foo', 'bar', $event->getController()->content);
    }
}
```

## Impact {#impact}

The event `AfterCacheableContentIsGeneratedEvent` can be used
to decide if a page should be stored in cache and is executed right after
all cacheable content is generated. It can also be used to manipulate
the content before it is stored in TYPO3's page cache. The event is used
in indexed search to index cacheable content.

The `AfterCacheableContentIsGeneratedEvent` contains the
information if a generated page is able to store in cache via the
`$event->isCachingEnabled()` method. This can be used to
differentiate between the previous hooks `contentPostProc-cached` and
`contentPostProc-all` (do something regardless if caching is enabled or not).

The `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.
