‪TYPO3CMS  ‪main
CacheInstruction.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
29 {
30  private bool ‪$allowCaching = true;
31  private array ‪$disabledCacheReasons = [];
32 
47  public function ‪disableCache(string $reason): void
48  {
49  if (empty($reason)) {
50  throw new \RuntimeException(
51  'A non-empty reason must be given to disable cache. At least mention the extension name that triggers it.',
52  1701528694
53  );
54  }
55  $this->allowCaching = false;
56  $this->disabledCacheReasons[] = $reason;
57  }
58 
59  public function ‪isCachingAllowed(): bool
60  {
62  }
63 
67  public function ‪getDisabledCacheReasons(): array
68  {
70  }
71 }
‪TYPO3\CMS\Frontend\Cache\CacheInstruction\$disabledCacheReasons
‪array $disabledCacheReasons
Definition: CacheInstruction.php:31
‪TYPO3\CMS\Frontend\Cache\CacheInstruction\$allowCaching
‪bool $allowCaching
Definition: CacheInstruction.php:30
‪TYPO3\CMS\Frontend\Cache\CacheInstruction\disableCache
‪disableCache(string $reason)
Definition: CacheInstruction.php:47
‪TYPO3\CMS\Frontend\Cache\CacheInstruction\getDisabledCacheReasons
‪getDisabledCacheReasons()
Definition: CacheInstruction.php:67
‪TYPO3\CMS\Frontend\Cache
Definition: CacheInstruction.php:18
‪TYPO3\CMS\Frontend\Cache\CacheInstruction\isCachingAllowed
‪isCachingAllowed()
Definition: CacheInstruction.php:59
‪TYPO3\CMS\Frontend\Cache\CacheInstruction
Definition: CacheInstruction.php:29