public function getShares($providerName, $url, $delayUpdate = false)
    {
        $this->checkProvider($providerName);

        $id = $this->getId($providerName, $url);
        $lifeTime = $this->providers[$providerName]['lifeTime'];
        $now = new \DateTime();

        $dataFromCache = $this->cache->fetch($id);
        $shares = isset($dataFromCache[0]) ? $dataFromCache[0] : false;
        $expired = isset($dataFromCache[1]) && $dataFromCache[1]->add($lifeTime) < $now;

        if (!$delayUpdate && (false === $shares || $expired)) {
            $shares = $this->providers[$providerName]['provider']->getShares($url);

            $this->cache->save($id, array($shares, $now));
        } else {
            if ($delayUpdate && (false === $shares || $expired)) {
                $this->toUpdate[$providerName][] = $url;
            }

            $shares = intval($shares);
        }

        return $shares;
    }
public function getShares($providerName, $url, $delayUpdate = false)
    {
        $this->checkProvider($providerName);

        $id = $this->getId($providerName, $url);
        $lifeTime = $this->providers[$providerName]['lifeTime'];
        $now = new \DateTime();

        $dataFromCache = $this->cache->fetch($id);
        $shares = isset($dataFromCache[0]) ? $dataFromCache[0] : false;
        $expired = isset($dataFromCache[1]) && $dataFromCache[1]->add($lifeTime) < $now;

        if (!$delayUpdate && (false === $shares || $expired)) {
            $shares = $this->providers[$providerName]['provider']->getShares($url);

            $this->cache->save($id, array($shares, $now));
        } else {
            if ($delayUpdate && (false === $shares || $expired)) {
                $this->toUpdate[$providerName][] = $url;
            }

            $shares = intval($shares);
        }

        return $shares;
    }
public function getShares ( $ providerName , $ url , $ delayUpdate = false ) { $ this -> checkProvider ( $ providerName ) ; $ id = $ this -> getId ( $ providerName , $ url ) ; $ lifeTime = $ this -> providers [ $ providerName ] [ 'lifeTime' ] ; $ now = new \ DateTime ( ) ; $ dataFromCache = $ this -> cache -> fetch ( $ id ) ; $ shares = isset ( $ dataFromCache [ 0 ] ) ? $ dataFromCache [ 0 ] : false ; $ expired = isset ( $ dataFromCache [ 1 ] ) && $ dataFromCache [ 1 ] -> add ( $ lifeTime ) < $ now ; if ( ! $ delayUpdate && ( false === $ shares || $ expired ) ) { $ shares = $ this -> providers [ $ providerName ] [ 'provider' ] -> getShares ( $ url ) ; $ this -> cache -> save ( $ id , array ( $ shares , $ now ) ) ; } else { if ( $ delayUpdate && ( false === $ shares || $ expired ) ) { $ this -> toUpdate [ $ providerName ] [ ] = $ url ; } $ shares = intval ( $ shares ) ; } return $ shares ; }
Gets the number of share of the given URL on the given provider.

@param string $providerName
@param string $url
@param bool   $delayUpdate

@throws \RuntimeException

@return int
Gets the number of share of the given URL on the given provider .