---
title: "Deprecation: #111298 - DataHandler->clear_cacheCmd()"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:deprecation-111298-1793396636"
source: "Changelog/15.0/Deprecation-111298-DataHandlerClearCacheCmd.rst"
typo3-version: "15.0"
typo3-major: 15
type: "deprecation"
issue: 111298
forge: "https://forge.typo3.org/issues/111298"
tags: ["PHP-API", "FullyScanned", "ext:core"]
rendered: "2026-11-14T17:17:53+00:00"
---

# Deprecation: #111298 - DataHandler->clear_cacheCmd() {#deprecation-111298-1793396636}

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

## Description {#description}

The method
`\TYPO3\CMS\Core\DataHandling\DataHandler->clear_cacheCmd()` has been
deprecated. Cache commands such as "pages", "all", a page id or
"cacheTag:\<tag>" are flushed by
`\TYPO3\CMS\Core\Cache\Flush\CacheFlusher`, which needs no
`\TYPO3\CMS\Core\DataHandling\DataHandler` instance, see
[Feature: #111263 - Flush caches without DataHandler](https://docs.typo3.org/permalink/changelog:feature-111263-1793181135).

## Impact {#impact}

Calling the method triggers a PHP `E_USER_DEPRECATED` error. The
extension scanner reports usages.

## Affected installations {#affected-installations}

Installations with extensions calling
`DataHandler->clear_cacheCmd()`, usually to flush caches without
processing any data map or command map.

## Migration {#migration}

Flush the cache command with
`\TYPO3\CMS\Core\Cache\Flush\CacheFlusher`. Pass a
`\TYPO3\CMS\Core\Cache\Flush\CacheFlushingContext` created from
the backend user to keep checking the permissions of User TSconfig
`options.clearCache`. Without it, the command is flushed
unrestricted, which fits scheduler tasks or console commands.

Before:

```php
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
$dataHandler->start([], []);
$dataHandler->clear_cacheCmd('pages');
```

After:

```php
use TYPO3\CMS\Core\Cache\Flush\CacheFlushDemand;
use TYPO3\CMS\Core\Cache\Flush\CacheFlusher;
use TYPO3\CMS\Core\Cache\Flush\CacheFlushingContext;

public function __construct(
    private readonly CacheFlusher $cacheFlusher,
) {}

public function flushPageCaches(): void
{
    $this->cacheFlusher->flush(
        CacheFlushDemand::forCommand('pages'),
        CacheFlushingContext::fromBackendUser($GLOBALS['BE_USER'])
    );
}
```
