79 if (!extension_loaded(
'apc')) {
80 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);
82 if (PHP_SAPI ===
'cli' && ini_get(
'apc.enable_cli') == 0) {
83 throw new \TYPO3\CMS\Core\Cache\Exception(
'The APC backend cannot be used because apc is disabled on CLI.', 1232985415);
85 parent::__construct(
$context, $options);
95 parent::setCache($cache);
108 return extension_loaded(
'posix') ? posix_getpwuid(posix_geteuid()) : array(
'name' =>
'default');
132 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {
133 if (!$this->cache instanceof \
TYPO3\CMS\Core\
Cache\Frontend\FrontendInterface) {
134 throw new \TYPO3\CMS\Core\Cache\Exception(
'No cache frontend has been set yet via setCache().', 1232986818);
136 if (!is_string($data)) {
137 throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException(
'The specified data is of type "' . gettype($data) .
'" but a string is expected.', 1232986825);
142 if ($success === TRUE) {
146 throw new \TYPO3\CMS\Core\Cache\Exception(
'Could not set value.', 1232986877);
157 public function get($entryIdentifier) {
160 return $success ? $value : $success;
170 public function has($entryIdentifier) {
185 public function remove($entryIdentifier) {
201 if ($success === FALSE) {
204 return (array) $identifiers;
218 return $success ? (array) $tags : array();
229 if (!$this->cache instanceof \
TYPO3\CMS\Core\
Cache\Frontend\FrontendInterface) {
230 throw new \TYPO3\CMS\Core\Cache\Exception(
'Yet no cache frontend has been set via setCache().', 1232986971);
232 $this->
flushByTag(
'%APCBE%' . $this->cacheIdentifier);
244 foreach ($identifiers as $identifier) {
245 $this->
remove($identifier);
259 $existingTagsUpdated = FALSE;
261 foreach ($tags as $tag) {
264 if (!in_array($entryIdentifier, $identifiers, TRUE)) {
265 $identifiers[] = $entryIdentifier;
269 if (!in_array($tag, $existingTags, TRUE)) {
270 $existingTags[] = $tag;
271 $existingTagsUpdated = TRUE;
276 if ($existingTagsUpdated) {
291 foreach ($tags as $tag) {
298 if (($key = array_search($entryIdentifier, $identifiers)) !== FALSE) {
299 unset($identifiers[$key]);
300 if (count($identifiers)) {
__construct($context, array $options=array())
setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
setIdentifierPrefix($identifierPrefix)
addIdentifierToTags($entryIdentifier, array $tags)
findTagsByIdentifier($identifier)
static shortMD5($input, $len=10)
findIdentifiersByTag($tag)
removeIdentifierFromAllTags($entryIdentifier)