cache notice and user counts in sitemap index

This commit is contained in:
Evan Prodromou 2010-04-12 12:13:48 -04:00
parent da8b231d2e
commit 09e5046dd3

View File

@ -101,7 +101,9 @@ class SitemapindexAction extends Action
function getUserCounts()
{
// XXX: cachemeplease
$userCounts = User::cacheGet('sitemap:user:counts');
if ($userCounts === false) {
$user = new User();
@ -117,12 +119,17 @@ class SitemapindexAction extends Action
$userCounts[$user->regdate] = $user->regcount;
}
User::cacheSet('sitemap:user:counts', $userCounts);
}
return $userCounts;
}
function getNoticeCounts()
{
// XXX: cachemeplease
$noticeCounts = Notice::cacheGet('sitemap:notice:counts');
if ($noticeCounts === false) {
$notice = new Notice();
@ -138,6 +145,9 @@ class SitemapindexAction extends Action
$noticeCounts[$notice->postdate] = $notice->postcount;
}
Notice::cacheSet('sitemap:notice:counts', $noticeCounts);
}
return $noticeCounts;
}