‪TYPO3CMS  10.4
PhpFrontend.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
25 {
33  {
34  parent::__construct(‪$identifier, ‪$backend);
35  }
36 
47  public function set($entryIdentifier, $sourceCode, array $tags = [], $lifetime = null)
48  {
49  if (!$this->‪isValidEntryIdentifier($entryIdentifier)) {
50  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823);
51  }
52  if (!is_string($sourceCode)) {
53  throw new ‪InvalidDataException('The given source code is not a valid string.', 1264023824);
54  }
55  foreach ($tags as $tag) {
56  if (!$this->‪isValidTag($tag)) {
57  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825);
58  }
59  }
60  $sourceCode = '<?php' . LF . $sourceCode . LF . '#';
61  $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime);
62  }
63 
71  public function get($entryIdentifier)
72  {
73  if (!$this->‪isValidEntryIdentifier($entryIdentifier)) {
74  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057753);
75  }
76  return $this->backend->get($entryIdentifier);
77  }
78 
85  public function ‪requireOnce($entryIdentifier)
86  {
87  return $this->backend->requireOnce($entryIdentifier);
88  }
89 
99  public function require(string $entryIdentifier)
100  {
101  return $this->backend->require($entryIdentifier);
102  }
103 }
‪TYPO3\CMS\Core\Cache\Frontend\PhpFrontend\requireOnce
‪mixed requireOnce($entryIdentifier)
Definition: PhpFrontend.php:85
‪TYPO3\CMS\Core\Cache\Frontend
Definition: AbstractFrontend.php:16
‪TYPO3\CMS\Core\Cache\Frontend\PhpFrontend
Definition: PhpFrontend.php:25
‪TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend\$backend
‪AbstractBackend TaggableBackendInterface $backend
Definition: AbstractFrontend.php:36
‪TYPO3\CMS\Core\Cache\Frontend\PhpFrontend\__construct
‪__construct($identifier, PhpCapableBackendInterface $backend)
Definition: PhpFrontend.php:32
‪TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface
Definition: PhpCapableBackendInterface.php:23
‪TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend\$identifier
‪string $identifier
Definition: AbstractFrontend.php:32
‪TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend\isValidEntryIdentifier
‪bool isValidEntryIdentifier($identifier)
Definition: AbstractFrontend.php:171
‪TYPO3\CMS\Core\Cache\Exception\InvalidDataException
Definition: InvalidDataException.php:24
‪TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend\isValidTag
‪bool isValidTag($tag)
Definition: AbstractFrontend.php:182
‪TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend
Definition: AbstractFrontend.php:27