Cache is not working with BIG-sitemaps
Why cache is not working here ?
$sitemap->isCached()
value always false
Simple code example:
public function generate()
{
$sitemap = App::make('sitemap');
$sitemap->setCache('sitemap.cache', 500);
if (!$sitemap->isCached()) {
$products = DB::table('products')->orderBy('created_at', 'desc')->get();
$counter = 0;
$sitemapCounter = 0;
foreach ($products as $p) {
if ($counter == 50000) {
$sitemap->store('xml', 'sitemap-' . $sitemapCounter);
$sitemap->addSitemap(secure_url('sitemap-' . $sitemapCounter . '.xml'));
$sitemap->model->resetItems();
$counter = 0;
$sitemapCounter++;
}
$sitemap->add($p->slug, $p->modified, $p->priority, $p->freq);
$counter++;
}
if (!empty($sitemap->model->getItems())) {
$sitemap->store('xml', 'sitemap-' . $sitemapCounter);
$sitemap->addSitemap(secure_url('sitemap-' . $sitemapCounter . '.xml'));
$sitemap->model->resetItems();
}
}
return $sitemap->render('sitemapindex');
}
Edited by Abdelrahman Badreldeen