/** * @param string $url * @return mixed */ public function get($url) { $filePath = $this->getFilePath(); if (file_exists($filePath)) { $lastMod = filemtime($filePath); // cache is valid if (date('mdY') == date('mdY', $lastMod)) { return file_get_contents($filePath); } } else { touch($filePath); } // cache outdated $content = parent::get($url); file_put_contents($filePath, $content); return $content; }