+ if (true !== $e && [] !== $e) {
+ $message = 'Failed to save the new namespace'.($e instanceof \Exception ? ': '.$e->getMessage() : '.');
+ CacheItem::log($this->logger, $message, ['exception' => $e instanceof \Exception ? $e : null]);
+ }
+ }
+
+ if (\is_string($key) && isset($this->ids[$key])) {
+ return $this->namespace.$this->namespaceVersion.$this->ids[$key];
+ }
+ CacheItem::validateKey($key);
+ $this->ids[$key] = $key;
+
+ if (\count($this->ids) > 1000) {
+ $this->ids = \array_slice($this->ids, 500, null, true); // stop memory leak if there are many keys