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
1 changed files with 28 additions and 18 deletions

View File

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