1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00

Update StatusHashtagService, fix count bug

This commit is contained in:
Daniel Supernault 2019-09-10 22:03:45 -06:00
parent 22d9449936
commit fe736f2b44
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -56,11 +56,11 @@ class StatusHashtagService {
public static function count($id)
{
$count = Redis::zcount(self::CACHE_KEY . $id, '-inf', '+inf');
if(empty($count)) {
$count = StatusHashtag::whereHashtagId($id)->count();
}
return $count;
$key = 'pf:services:status-hashtag:count:' . $id;
$ttl = now()->addHours(6);
return Cache::remember($key, $ttl, function() use($id) {
return StatusHashtag::whereHashtagId($id)->count();
});
}
public static function getStatus($statusId, $hashtagId)