cache sitemap notice and user counts for 4h
This commit is contained in:
parent
453a06fff4
commit
d73feb82d8
|
@ -593,7 +593,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
return $c->get($cacheKey);
|
return $c->get($cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function cacheSet($keyPart, $value)
|
static function cacheSet($keyPart, $value, $flag=null, $expiry=null)
|
||||||
{
|
{
|
||||||
$c = self::memcache();
|
$c = self::memcache();
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
|
|
||||||
$cacheKey = common_cache_key($keyPart);
|
$cacheKey = common_cache_key($keyPart);
|
||||||
|
|
||||||
return $c->set($cacheKey, $value);
|
return $c->set($cacheKey, $value, $flag, $expiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function valueString($v)
|
static function valueString($v)
|
||||||
|
|
|
@ -153,7 +153,9 @@ class Sitemap_notice_count extends Memcached_DataObject
|
||||||
$noticeCounts[$snc->notice_date] = $snc->notice_count;
|
$noticeCounts[$snc->notice_date] = $snc->notice_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::cacheSet('sitemap:notice:counts', $noticeCounts);
|
// Cache notice counts for 4 hours.
|
||||||
|
|
||||||
|
self::cacheSet('sitemap:notice:counts', $noticeCounts, null, time() + 4 * 60 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $noticeCounts;
|
return $noticeCounts;
|
||||||
|
|
|
@ -154,7 +154,9 @@ class Sitemap_user_count extends Memcached_DataObject
|
||||||
$userCounts[$suc->registration_date] = $suc->user_count;
|
$userCounts[$suc->registration_date] = $suc->user_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::cacheSet('sitemap:user:counts', $userCounts);
|
// Cache user counts for 4 hours.
|
||||||
|
|
||||||
|
self::cacheSet('sitemap:user:counts', $userCounts, null, time() + 4 * 60 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $userCounts;
|
return $userCounts;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user