private function getFreshDataWithCache(QueueItem $item)
    {
        $sdk = $this->getSdk($item);
        $entity = $sdk->get($item->getId())->wait(true);
        if (false === $this->shouldCacheEntity($item->getType(), $item->getId())) {
            return $entity;
        }
        if ($entity) {
            $this->logger->debug('Saving to cache', [
                'type' => $item->getType(),
                'id' => $item->getId(),
            ]);
            $this->cache->save(
                $this->getKeyFromQueueItem($item),
                $this->serializer->serialize($entity, 'json', ['type' => true]),
                $this->lifetime
            );
        } else {
            $this->logger->debug('404 from SDK', [
                'type' => $item->getType(),
                'id' => $item->getId(),
            ]);
        }

        return $entity;
    }
private function getFreshDataWithCache(QueueItem $item)
    {
        $sdk = $this->getSdk($item);
        $entity = $sdk->get($item->getId())->wait(true);
        if (false === $this->shouldCacheEntity($item->getType(), $item->getId())) {
            return $entity;
        }
        if ($entity) {
            $this->logger->debug('Saving to cache', [
                'type' => $item->getType(),
                'id' => $item->getId(),
            ]);
            $this->cache->save(
                $this->getKeyFromQueueItem($item),
                $this->serializer->serialize($entity, 'json', ['type' => true]),
                $this->lifetime
            );
        } else {
            $this->logger->debug('404 from SDK', [
                'type' => $item->getType(),
                'id' => $item->getId(),
            ]);
        }

        return $entity;
    }
private function getFreshDataWithCache ( QueueItem $ item ) { $ sdk = $ this -> getSdk ( $ item ) ; $ entity = $ sdk -> get ( $ item -> getId ( ) ) -> wait ( true ) ; if ( false === $ this -> shouldCacheEntity ( $ item -> getType ( ) , $ item -> getId ( ) ) ) { return $ entity ; } if ( $ entity ) { $ this -> logger -> debug ( 'Saving to cache' , [ 'type' => $ item -> getType ( ) , 'id' => $ item -> getId ( ) , ] ) ; $ this -> cache -> save ( $ this -> getKeyFromQueueItem ( $ item ) , $ this -> serializer -> serialize ( $ entity , 'json' , [ 'type' => true ] ) , $ this -> lifetime ) ; } else { $ this -> logger -> debug ( '404 from SDK' , [ 'type' => $ item -> getType ( ) , 'id' => $ item -> getId ( ) , ] ) ; } return $ entity ; }
Get fresh data with cache.

This method call guarantees a fresh copy of them entity in ApiSDK represented
by the QueueItem. If the item should be cached, it will be cached at this point.

@return mixed
Get fresh data with cache .