private const TAGS_PREFIX = "\1tags\1";
protected function __construct(string
$namespace = '', int
$defaultLifetime = 0
) { $this->namespace = '' ===
$namespace ? '' : CacheItem::
validateKey($namespace).':';
$this->defaultLifetime =
$defaultLifetime;
if (null !==
$this->maxIdLength && \
strlen($namespace) >
$this->maxIdLength - 24
) { throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").',
$this->maxIdLength - 24, \
strlen($namespace),
$namespace));
} self::
$createCacheItem ??= \Closure::
bind( static function D
$key,
$value,
$isHit) { $item =
new CacheItem();
$item->key =
$key;
$item->isTaggable = true;
// If structure does not match what we expect return item as is (no value and not a hit)
if (!\
is_array($value) || !\
array_key_exists('value',
$value)) { return $item;
} $item->isHit =
$isHit;
// Extract value, tags and meta data from the cache value
$item->value =
$value['value'
];
$item->metadata
[CacheItem::METADATA_TAGS
] =
isset($value['tags'
]) ?
array_combine($value['tags'
],
$value['tags'
]) :
[];
if (isset($value['meta'
])) {