public function search($q, $pageToken = '', $perPage = 10)
{
if (!$this->enabled()) {
return false;
}
$uri = sprintf('search?part=snippet&type=video&maxResults=%s&pageToken=%s&q=%s', $perPage, urlencode($pageToken), urlencode($q));
$cacheKey = md5("youtube_{$uri}");
if ($response = Cache::get($cacheKey)) {
return $response;
}
if ($response = $this->get($uri)) {
// Cache the result for 7 days
Cache::put($cacheKey, $response, 60 * 24 * 7);
}
return $response;
}