protected function getContents($url, $headers = [], $as_html = false) { $key = $this->buildCacheKey($url); if (self::$cache->has($key)) { return self::$cache->get($key); } if ($as_html) { foreach ($headers as $k => $v) { $this->client->setHeader($k, $v); } $contents = $this->client->request('GET', $url)->html(); foreach ($headers as $k => $v) { $this->client->removeHeader($k); } } else { $contents = file_get_contents($url); } self::$cache->set($key, $contents); return $contents; }
public function __construct(\Memcache $memcache, $default_ttl) { parent::__construct($default_ttl); $this->instance = $memcache; }
public function __construct($path, $ttl) { parent::__construct($ttl); $this->path = $path; }