private function getCachedData()
{
// no search term = no search
if (!$this->term) {
return false;
}
// debug mode = no cache
if ($this->getContainer()->getParameter('kernel.debug')) {
return false;
}
// check if cache file exists
if (!is_file($this->cacheFile)) {
return false;
}
// get cache file modification time
$cacheInfo = @filemtime($this->cacheFile);
// check if cache file is recent enough (1 hour)
if (!$cacheInfo || $cacheInfo < strtotime('-1 hour')) {
return false;
}
// include cache file
require_once $this->cacheFile;
// set info (received from cache)
$this->pagination = $pagination;
$this->items = $items;
return true;
}