*/ use TraceableCacheAdapterTrait; /** * @param HubInterface $hub The current hub * @param AdapterInterface $decoratedAdapter The decorated cache adapter */ public function __construct(HubInterface $hub, AdapterInterface $decoratedAdapter) { $this->hub = $hub; $this->decoratedAdapter = $decoratedAdapter; } /** * {@inheritdoc} * * @param mixed[] $metadata */ public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed { return $this->traceFunction('cache.get_item', function () use ($key, $callback, $beta, &$metadata) { if (!$this->decoratedAdapter instanceof CacheInterface) { throw new \BadMethodCallException(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->get($key, $callback, $beta, $metadata); }, $key); } }