81 if (!extension_loaded(
'apcu')) {
82 throw new Exception(
'The PHP extension "apcu" must be installed and loaded in order to use the APCu backend.', 1232985914);
84 if (PHP_SAPI ===
'cli' && ini_get(
'apc.enable_cli') == 0) {
85 throw new Exception(
'The APCu backend cannot be used because apcu is disabled on CLI.', 1232985915);
111 return extension_loaded(
'posix') ? posix_getpwuid(posix_geteuid()) : [
'name' =>
'default'];
124 public function set($entryIdentifier, $data, array $tags = [], $lifetime =
null)
127 throw new Exception(
'No cache frontend has been set yet via setCache().', 1232986118);
129 if (!is_string($data)) {
130 throw new InvalidDataException(
'The specified data is of type "' . gettype($data) .
'" but a string is expected.', 1232986125);
135 if ($success ===
true) {
139 $this->logger->alert(
'Error using APCu: Could not save data in the cache.');
149 public function get($entryIdentifier)
153 return $success ? $value : $success;
162 public function has($entryIdentifier)
177 public function remove($entryIdentifier)
194 if ($success ===
false) {
197 return (array)$identifiers;
211 return $success ? (array)$tags : [];
222 throw new Exception(
'Yet no cache frontend has been set via setCache().', 1232986571);
224 $this->
flushByTag(
'%APCBE%' . $this->cacheIdentifier);
235 foreach ($identifiers as $identifier) {
236 $this->
remove($identifier);
250 $existingTagsUpdated =
false;
252 foreach ($tags as $tag) {
255 if (!in_array($entryIdentifier, $identifiers,
true)) {
256 $identifiers[] = $entryIdentifier;
260 if (!in_array($tag, $existingTags,
true)) {
261 $existingTags[] = $tag;
262 $existingTagsUpdated =
true;
267 if ($existingTagsUpdated) {
282 foreach ($tags as $tag) {
289 if (($key = array_search($entryIdentifier, $identifiers)) !==
false) {
290 unset($identifiers[$key]);
291 if (!empty($identifiers)) {