2 namespace TYPO3\CMS\Core\Cache\Backend;
78 if (!extension_loaded(
'apc')) {
79 throw new \TYPO3\CMS\Core\Cache\Exception(
'The PHP extension "apc" or "apcu" must be installed and loaded in order to use the APC backend.', 1232985414);
81 if (PHP_SAPI ===
'cli' && ini_get(
'apc.enable_cli') == 0) {
82 throw new \TYPO3\CMS\Core\Cache\Exception(
'The APC backend cannot be used because apc is disabled on CLI.', 1232985415);
84 parent::__construct(
$context, $options);
93 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
$cache)
95 parent::setCache($cache);
97 $pathHash = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->
getPathSite() . $processUser[
'name'] . $this->context . $cache->getIdentifier(), 12);
109 return extension_loaded(
'posix') ? posix_getpwuid(posix_geteuid()) : array(
'name' =>
'default');
134 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = null)
136 if (!$this->cache instanceof \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface) {
137 throw new \TYPO3\CMS\Core\Cache\Exception(
'No cache frontend has been set yet via setCache().', 1232986818);
139 if (!is_string($data)) {
140 throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException(
'The specified data is of type "' . gettype($data) .
'" but a string is expected.', 1232986825);
145 if ($success ===
true) {
149 throw new \TYPO3\CMS\Core\Cache\Exception(
'Could not set value.', 1232986877);
160 public function get($entryIdentifier)
164 return $success ? $value : $success;
174 public function has($entryIdentifier)
190 public function remove($entryIdentifier)
208 if ($success ===
false) {
211 return (array)$identifiers;
226 return $success ? (array)$tags : array();
238 if (!$this->cache instanceof \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface) {
239 throw new \TYPO3\CMS\Core\Cache\Exception(
'Yet no cache frontend has been set via setCache().', 1232986971);
241 $this->
flushByTag(
'%APCBE%' . $this->cacheIdentifier);
254 foreach ($identifiers as $identifier) {
255 $this->
remove($identifier);
270 $existingTagsUpdated =
false;
272 foreach ($tags as $tag) {
275 if (!in_array($entryIdentifier, $identifiers,
true)) {
276 $identifiers[] = $entryIdentifier;
280 if (!in_array($tag, $existingTags,
true)) {
281 $existingTags[] = $tag;
282 $existingTagsUpdated =
true;
287 if ($existingTagsUpdated) {
303 foreach ($tags as $tag) {
310 if (($key = array_search($entryIdentifier, $identifiers)) !==
false) {
311 unset($identifiers[$key]);
312 if (!empty($identifiers)) {