public static function getUserTwits(User $user) { if (!isset(self::$twits[$user->getName()])) { return []; } return self::$twits[$user->getName()]; }
public function getLastTwits(User $user, $version, $twit_number) { $call = $version . '/statuses/user_timeline.json?screen_name=' . $user->getName() . '&count=' . $twit_number; try { return $this->parseTwitResponse($this->client->get($call)->json(), $user); } catch (\GuzzleHttp\Exception\ClientException $e) { throw new \Symfony\Component\HttpKernel\Exception\HttpException(400, 'User not found'); } }
public function getUserTwits(User $user) { $cache = $this->memcache ? $this->memcache->get($user->getName()) : false; $twits = []; if (!$cache) { $resp = $this->twitConsumer->getLastTwits($user, $this->version, $this->twit_number); if (isset($resp[$user->getName()])) { $twits = $resp[$user->getName()]; } if ($this->memcache) { $this->memcache->set($user->getName(), $twits, 0, 1000000); } } else { $twits = $cache; } return $twits; }