forked from mirror/pixelfed
Update StatusHashtagService, fix count bug
This commit is contained in:
parent
22d9449936
commit
fe736f2b44
|
@ -56,11 +56,11 @@ class StatusHashtagService {
|
||||||
|
|
||||||
public static function count($id)
|
public static function count($id)
|
||||||
{
|
{
|
||||||
$count = Redis::zcount(self::CACHE_KEY . $id, '-inf', '+inf');
|
$key = 'pf:services:status-hashtag:count:' . $id;
|
||||||
if(empty($count)) {
|
$ttl = now()->addHours(6);
|
||||||
$count = StatusHashtag::whereHashtagId($id)->count();
|
return Cache::remember($key, $ttl, function() use($id) {
|
||||||
}
|
return StatusHashtag::whereHashtagId($id)->count();
|
||||||
return $count;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getStatus($statusId, $hashtagId)
|
public static function getStatus($statusId, $hashtagId)
|
||||||
|
|
Loading…
Reference in New Issue